-
Notifications
You must be signed in to change notification settings - Fork 3.6k
feat(linters): Added golangci-lint config & CI job #304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
35670d5
d69ef65
d9b5f64
552d6f1
67d0710
0785a05
24e35a1
d6f052f
272cabc
b88f4c9
ef89650
df52d4a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,184 @@ | ||
| version: "2" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [POSITIVE] Using golangci-lint v2 config format with Nice config overall — the revive rules, test exclusions, and formatter setup are all well-tuned. |
||
|
|
||
| linters: | ||
| default: all | ||
| disable: | ||
| # TODO: Tweak for current project needs | ||
| - containedctx | ||
| - cyclop | ||
| - depguard | ||
| - dupl | ||
| - dupword | ||
| - err113 | ||
| - exhaustruct | ||
| - funcorder | ||
| - gochecknoglobals | ||
| - godot | ||
| - intrange | ||
| - ireturn | ||
| - nlreturn | ||
| - noctx | ||
| - noinlineerr | ||
| - nonamedreturns | ||
| - tagliatelle | ||
| - testpackage | ||
| - varnamelen | ||
| - wrapcheck | ||
| - wsl | ||
| - wsl_v5 | ||
|
|
||
| # TODO: Disabled, because they are failing at the moment, we should fix them and enable (step by step) | ||
| - bodyclose | ||
| - contextcheck | ||
| - dogsled | ||
| - embeddedstructfieldcheck | ||
| - errcheck | ||
| - errchkjson | ||
| - errorlint | ||
| - exhaustive | ||
| - forbidigo | ||
| - forcetypeassert | ||
| - funlen | ||
| - gochecknoinits | ||
| - gocognit | ||
| - goconst | ||
| - gocritic | ||
| - gocyclo | ||
| - godox | ||
| - goprintffuncname | ||
| - gosec | ||
| - govet | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [MEDIUM] Once enabled here, the separate |
||
| - ineffassign | ||
| - lll | ||
| - maintidx | ||
| - misspell | ||
| - mnd | ||
| - modernize | ||
| - nakedret | ||
| - nestif | ||
| - nilnil | ||
| - paralleltest | ||
| - perfsprint | ||
| - prealloc | ||
| - predeclared | ||
| - revive | ||
| - staticcheck | ||
| - tagalign | ||
| - testifylint | ||
| - thelper | ||
| - unparam | ||
| - unused | ||
| - usestdlibvars | ||
| - usetesting | ||
| - wastedassign | ||
| - whitespace | ||
| settings: | ||
| errcheck: | ||
| check-type-assertions: true | ||
| check-blank: true | ||
| exhaustive: | ||
| default-signifies-exhaustive: true | ||
| funlen: | ||
| lines: 120 | ||
| statements: 40 | ||
| gocognit: | ||
| min-complexity: 25 | ||
| gocyclo: | ||
| min-complexity: 20 | ||
| govet: | ||
| enable-all: true | ||
| disable: | ||
| - fieldalignment | ||
| lll: | ||
| line-length: 120 | ||
| tab-width: 4 | ||
| misspell: | ||
| locale: US | ||
| mnd: | ||
| checks: | ||
| - argument | ||
| - assign | ||
| - case | ||
| - condition | ||
| - operation | ||
| - return | ||
| nakedret: | ||
| max-func-lines: 3 | ||
| revive: | ||
| enable-all-rules: true | ||
| rules: | ||
| - name: add-constant | ||
| disabled: true | ||
| - name: argument-limit | ||
| arguments: | ||
| - 7 | ||
| severity: warning | ||
| - name: banned-characters | ||
| disabled: true | ||
| - name: cognitive-complexity | ||
| disabled: true | ||
| - name: comment-spacings | ||
| arguments: | ||
| - nolint | ||
| severity: warning | ||
| - name: cyclomatic | ||
| disabled: true | ||
| - name: file-header | ||
| disabled: true | ||
| - name: function-result-limit | ||
| arguments: | ||
| - 3 | ||
| severity: warning | ||
| - name: function-length | ||
| disabled: true | ||
| - name: line-length-limit | ||
| disabled: true | ||
| - name: max-public-structs | ||
| disabled: true | ||
| - name: modifies-value-receiver | ||
| disabled: true | ||
| - name: package-comments | ||
| disabled: true | ||
| - name: unused-receiver | ||
| disabled: true | ||
| exclusions: | ||
| generated: lax | ||
| rules: | ||
| - linters: | ||
| - lll | ||
| source: '^//go:generate ' | ||
| - linters: | ||
| - funlen | ||
| - maintidx | ||
| - gocognit | ||
| - gocyclo | ||
| path: _test\.go$ | ||
|
|
||
| issues: | ||
| max-issues-per-linter: 0 | ||
| max-same-issues: 0 | ||
|
|
||
| formatters: | ||
| enable: | ||
| - goimports | ||
| # TODO: Disabled, because they are failing at the moment, we should fix them and enable (step by step) | ||
| # - gci | ||
| # - gofmt | ||
| # - gofumpt | ||
| # - golines | ||
| settings: | ||
| gci: | ||
| sections: | ||
| - standard | ||
| - default | ||
| - localmodule | ||
| custom-order: true | ||
| gofmt: | ||
| simplify: true | ||
| rewrite-rules: | ||
| - pattern: "interface{}" | ||
| replacement: "any" | ||
| - pattern: "a[b:len(a)]" | ||
| replacement: "a[b:]" | ||
| golines: | ||
| max-len: 120 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[MEDIUM]
version: latestcombined withdefault: allin.golangci.yamlmeans any new linter introduced in a golangci-lint release will be auto-enabled and could break all PRs.Suggestion: Pin to a specific version:
This way CI upgrades are intentional, not accidental.