version: "2" run: allow-parallel-runners: true linters: default: none enable: - asasalint - asciicheck - bidichk - bodyclose - containedctx - copyloopvar - dupword - durationcheck - errcheck - errchkjson - fatcontext - gocritic - godot - goprintffuncname - gosec - govet - importas - ineffassign - intrange - misspell - nilerr - noctx - nolintlint - nosprintfhostport - paralleltest - prealloc - revive - staticcheck - testifylint - unconvert - unused - usestdlibvars - whitespace # TODO(vincepri): Figure out if we want to enable or remove the following linters: # - predeclared # - goconst settings: gocritic: disabled-checks: - appendAssign - dupImport # https://github.com/go-critic/go-critic/issues/845 - ifElseChain - octalLiteral - typeDefFirst - unnamedResult - whyNoLint - unnecessaryBlock - rangeValCopy - hugeParam - commentedOutCode - emptyStringTest - singleCaseSwitch - nestingReduce - tooManyResultsChecker enabled-tags: - diagnostic - experimental - performance gosec: excludes: - G307 # Deferring unsafe method "Close" on type "\*os.File" - G108 # Profiling endpoint is automatically exposed on /debug/pprof # TODO(vincepri): The following should be looked at and removed in future iterations. - G401 # Use of weak cryptographic primitive (replace sha1 usage) - G505 # crypto/sha1: weak cryptographic primitive - G402 # TLS MinVersion too low (set MinVersion in TLSClientConfig) - G404 # Use of weak random number generator (use crypto/rand) - G101 # Potential hardcoded credentials (returns false positives) - G306 # Expect WriteFile permissions to be 0600 or less # gosec is currently producing a lot of false-positives on taint analysis. # see https://github.com/securego/gosec/issues/1500 - G704 - G705 misspell: ignore-rules: - creater nolintlint: require-specific: true allow-unused: false revive: # make sure error-strings issues actually surface (default confidence is 0.8) confidence: 0.6 rules: - name: context-keys-type - name: duplicated-imports - name: error-return - name: error-strings - name: error-naming - name: if-return - name: increment-decrement - name: var-declaration - name: package-comments - name: range - name: receiver-naming - name: time-naming - name: errorf - name: superfluous-else - name: unreachable-code - name: bool-literal-in-expr - name: constant-logical-expr # TODO(vincepri): Figure out if we want to enable # the following rules, or remove them completely, they're a bit noisy. # - name: context-as-argument # - name: var-naming # - name: exported # - name: unexported-return # - name: blank-imports # - name: indent-error-flow # I think @ncdc prefers explicit else statements, remove? # - name: redefines-builtin-id # - name: dot-imports paralleltest: check-cleanup: true exclusions: generated: lax presets: - comments - common-false-positives - legacy - std-error-handling rules: - linters: - gosec path: test/e2e/* - linters: - gosec path: test/upgrade/* - linters: - staticcheck text: QF1008 # "could remove embedded field" often impedes readability and clarity paths: - third_party # TODO(embik): this is a blanket ignore specifically because of github.com/dev-kcp/client-go. - listers issues: max-issues-per-linter: 0 max-same-issues: 0 formatters: enable: - gci - gofmt settings: gci: sections: - standard - default - prefix(k8s.io) - prefix(github.com/kcp-dev) - prefix(github.com/kcp-dev/kcp) - blank - dot custom-order: true exclusions: generated: disable paths: - third_party$ - builtin$ - examples$