Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#11142 from schrej/golangci-comments
Browse files Browse the repository at this point in the history
🌱 golangci: add comments to enabled linters
  • Loading branch information
k8s-ci-robot authored Sep 9, 2024
2 parents 831e017 + e0cca37 commit a8ae016
Showing 1 changed file with 50 additions and 52 deletions.
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:
- "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
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

0 comments on commit a8ae016

Please sign in to comment.