ray-project / kuberay

A toolkit to run Ray applications on Kubernetes
Apache License 2.0
974 stars 330 forks source link

[Docs][Development] Delete linting docs #2145

Closed MortalHappiness closed 1 month ago

MortalHappiness commented 1 month ago

Why are these changes needed?

Delete the linting docs because golangci-lint already includes the gofumpt rule.

See https://github.com/ray-project/kuberay/pull/2128 for the rules.

Related issue number

N/A

Checks

MortalHappiness commented 1 month ago

Do you mean that gofumpt is already covered by pre-commit?

Yes. The gofumpt rule is enabled here: https://github.com/ray-project/kuberay/blob/4eedc32a2ddcfe3586e0dab71d3d5b5d4a0cc623/.golangci.yml#L51

To manually test this:

  1. Edit ray-operator/main.go to make it violate gofumpt rules. For example
    
    package main

import ( "flag" "fmt" "os" "strings"

Note that `fmt` is not indented.

2. Edit `.golangci.yml`
```yaml
linters-settings:
  gofmt:
    simplify: true
  ginkgolinter:
    forbid-focus-container: true
  goimports:
    local-prefixes: github.com/ray-project/kuberay/ray-operator,github.com/ray-project/kuberay/apiserver,github.com/ray-project/kuberay/cli,github.com/ray-project/kuberay/security
  misspell:
    locale: US
  revive:
    ignore-generated-header: true
    rules:
      - name: blank-imports
      - name: context-as-argument
      - name: context-keys-type
      - name: empty-block
      - name: error-naming
      - name: error-return
      - name: error-strings
      - name: errorf
      - name: exported
      - name: if-return
      - name: increment-decrement
      - name: indent-error-flow
      - name: package-comments
      - name: range
      - name: receiver-naming
      - name: redefines-builtin-id
      - name: superfluous-else
      - name: time-naming
      - name: unexported-return
      - name: unreachable-code
      - name: unused-parameter
      - name: var-declaration
      - name: var-naming
  gocyclo:
    min-complexity: 15
  govet:
    enable:
      - fieldalignment
  lll:
    line-length: 120
linters:
  enable:
#    - asciicheck
#    - errcheck
#    - errorlint
#    - ginkgolinter
#    - gocyclo
#    - gofmt
    - gofumpt
#    - goimports
#    - gosec
#    - gosimple
#    - govet
#    - ineffassign
#    - lll
#    - makezero
#    - misspell
#    - nilerr
#    - noctx
#    - predeclared
#    - revive
#    - staticcheck
#    - typecheck
#    - unconvert
#    - unparam
#    - unused
#    - wastedassign
  disable-all: true
issues:
  max-issues-per-linter: 0
  max-same-issues: 0
run:
  timeout: 3m

Note that only gofumpt rule is enabled.

  1. Try to commit the file changes in step 1.
  2. Note that pre-commit fails and the files in step 1 is reformatted by gofumpt.