-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
🌱 golangci: add comments to enabled linters #11142
Merged
+50
−52
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,62 +4,55 @@ run: | |
build-tags: | ||
- tools | ||
- e2e | ||
skip-files: | ||
- "zz_generated.*\\.go$" | ||
- "vendored_openapi\\.go$" | ||
# We don't want to invest time to fix new linter findings in old API types. | ||
- "internal/apis/.*" | ||
allow-parallel-runners: true | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- asasalint | ||
- asciicheck | ||
- bidichk | ||
- bodyclose | ||
- containedctx | ||
- copyloopvar | ||
- dogsled | ||
- dupword | ||
- durationcheck | ||
- errcheck | ||
- errchkjson | ||
- gci | ||
- ginkgolinter | ||
- goconst | ||
- gocritic | ||
- godot | ||
- gofmt | ||
- goimports | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- importas | ||
- ineffassign | ||
- intrange | ||
- loggercheck | ||
- misspell | ||
- nakedret | ||
- nilerr | ||
- noctx | ||
- nolintlint | ||
- nosprintfhostport | ||
- prealloc | ||
- predeclared | ||
- revive | ||
- rowserrcheck | ||
- staticcheck | ||
- stylecheck | ||
- tenv | ||
- thelper | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- usestdlibvars | ||
- whitespace | ||
- asasalint # warns about passing []any to func(...any) without expanding it | ||
- asciicheck # non ascii symbols | ||
- bidichk # dangerous unicode sequences | ||
- bodyclose # unclosed http bodies | ||
- containedctx # context.Context nested in a struct | ||
- copyloopvar # copying loop variables | ||
- dogsled # too many blank identifiers in assignments | ||
- dupword # duplicate words | ||
- durationcheck # multiplying two durations | ||
- errcheck # unchecked errors | ||
- errchkjson # invalid types passed to json encoder | ||
- gci # ensures imports are organized | ||
- ginkgolinter # ginkgo and gomega | ||
- goconst # strings that can be replaced by constants | ||
- gocritic # bugs, performance, style (we could add custom ones to this one) | ||
- godot # checks that comments end in a period | ||
- gofmt # warns about incorrect use of fmt functions | ||
- goimports # import formatting | ||
- goprintffuncname # printft-like functions should be named with f at the end | ||
- gosec # potential security problems | ||
- gosimple # simplify code | ||
- govet # basically 'go vet' | ||
- importas # consistent import aliases | ||
- ineffassign # ineffectual assignments | ||
- intrange # suggest using integer range in for loops | ||
- loggercheck # check for even key/value pairs in logger calls | ||
- misspell # spelling | ||
- nakedret # naked returns (named return parameters and an empty return) | ||
- nilerr # returning nil after checking err is not nil | ||
- noctx # http requests without context.Context | ||
- nolintlint # badly formatted nolint directives | ||
- nosprintfhostport # using sprintf to construct host:port in a URL | ||
- prealloc # suggest preallocating slices | ||
- predeclared # shadowing predeclared identifiers | ||
- revive # better version of golint | ||
- staticcheck # some of staticcheck's rules | ||
- stylecheck # another replacement for golint | ||
- tenv # using os.Setenv instead of t.Setenv in tests | ||
- thelper # test helpers not starting with t.Helper() | ||
- unconvert # unnecessary type conversions | ||
- unparam # unused function parameters | ||
- unused # unused constants, variables,functions, types | ||
- usestdlibvars # using variables/constants from the standard library | ||
- whitespace # unnecessary newlines | ||
|
||
linters-settings: | ||
gci: | ||
|
@@ -187,7 +180,6 @@ linters-settings: | |
alias: infraexpv1 | ||
nolintlint: | ||
allow-unused: false | ||
allow-leading-space: false | ||
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. It's okay due to this field isn't existing. |
||
require-specific: true | ||
revive: | ||
rules: | ||
|
@@ -224,6 +216,12 @@ linters-settings: | |
goconst: | ||
ignore-tests: true | ||
issues: | ||
exclude-files: | ||
- "zz_generated.*\\.go$" | ||
- "vendored_openapi\\.go$" | ||
# We don't want to invest time to fix new linter findings in old API types. | ||
- "internal/apis/.*" | ||
|
||
max-same-issues: 0 | ||
max-issues-per-linter: 0 | ||
# We are disabling default golangci exclusions because we want to help reviewers to focus on reviewing the most relevant | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We should write this configuration in issues section. It's good modification.