Skip to content
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
merged 1 commit into from
Sep 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 50 additions & 52 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,55 @@ run:
build-tags:
- tools
- e2e
skip-files:
Copy link
Member

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.

- "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:
Expand Down Expand Up @@ -187,7 +180,6 @@ linters-settings:
alias: infraexpv1
nolintlint:
allow-unused: false
allow-leading-space: false
Copy link
Member

Choose a reason for hiding this comment

The 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:
Expand Down Expand Up @@ -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
Expand Down
Loading