-
Notifications
You must be signed in to change notification settings - Fork 9
chore: Upgrades golangci-lint to v2 #556
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 hidden or 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
This file contains hidden or 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 |
---|---|---|
@@ -1,83 +1,98 @@ | ||
linters-settings: | ||
gocritic: | ||
enabled-tags: | ||
- diagnostic | ||
- experimental | ||
- opinionated | ||
- performance | ||
- style | ||
disabled-checks: | ||
- octalLiteral | ||
# We cannot control openapi format | ||
- hugeParam | ||
# Types are dynamic/OpenAPI driven. | ||
- paramTypeCombine | ||
- wrapperFunc | ||
- ptrToRefParam | ||
- emptyFallthrough | ||
- nestingReduce | ||
- sloppyReassign | ||
- typeAssertChain | ||
- builtinShadow | ||
gocyclo: | ||
min-complexity: 15 | ||
revive: | ||
# see https://github.com/mgechev/revive#available-rules for details. | ||
ignore-generated-header: true | ||
severity: warning | ||
rules: | ||
- name: blank-imports | ||
- name: context-as-argument | ||
- name: context-keys-type | ||
- name: dot-imports | ||
- name: error-return | ||
- name: error-strings | ||
- name: error-naming | ||
- name: errorf | ||
- name: exported | ||
# - name: indent-error-flow | ||
- name: if-return | ||
- name: increment-decrement | ||
# We want to maintain OpenAPI consistency and ignore golang standards | ||
# - name: var-naming | ||
# - name: var-declaration | ||
# - name: receiver-naming | ||
- name: package-comments | ||
- name: range | ||
- name: time-naming | ||
- name: unexported-return | ||
- name: errorf | ||
- name: empty-block | ||
- name: superfluous-else | ||
- name: struct-tag | ||
# OpenAPI paths can have 0 parameters | ||
# - name: unused-parameter | ||
# We still want empty methods for consistency - do not control if method will be empty. | ||
# - name: unused-receiver | ||
- name: unreachable-code | ||
version: "2" | ||
linters: | ||
# please, do not use `enable-all`: it's deprecated and will be removed soon. | ||
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint | ||
disable-all: true | ||
default: none | ||
enable: | ||
- bodyclose # checks whether HTTP response body is closed successfully [fast: false, auto-fix: false] | ||
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false] | ||
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: false, auto-fix: false] | ||
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. [fast: false, auto-fix: false] | ||
- gochecknoinits # Checks that no init functions are present in Go code [fast: true, auto-fix: false] | ||
- gocritic # Provides many diagnostics that check for bugs, performance and style issues. [fast: false, auto-fix: false] | ||
- goprintffuncname # Checks that printf-like functions are named with `f` at the end [fast: true, auto-fix: false] | ||
- gosec # Inspects source code for security problems [fast: false, auto-fix: false] | ||
- gosimple # Linter for Go source code that specializes in simplifying a code [fast: false, auto-fix: false] | ||
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: false, auto-fix: false] | ||
- misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true] | ||
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false] | ||
- nolintlint # Reports ill-formed or insufficient nolint directives [fast: true, auto-fix: false] | ||
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. [fast: false, auto-fix: false] | ||
- rowserrcheck # checks whether Err of rows is checked successfully [fast: false, auto-fix: false] | ||
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: false, auto-fix: false] | ||
- thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers [fast: false, auto-fix: false] | ||
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code [fast: false, auto-fix: false] | ||
- unconvert # Remove unnecessary type conversions [fast: false, auto-fix: false] | ||
- unparam # Reports unused function parameters [fast: false, auto-fix: false] | ||
- unused # Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false] | ||
- bodyclose | ||
- dogsled | ||
- errcheck | ||
- errorlint | ||
- gochecknoinits | ||
- gocritic | ||
- goprintffuncname | ||
- gosec | ||
- govet | ||
- misspell | ||
- nakedret | ||
- nolintlint | ||
- revive | ||
- rowserrcheck | ||
- staticcheck | ||
- thelper | ||
- unconvert | ||
- unparam | ||
- unused | ||
settings: | ||
gocritic: | ||
disabled-checks: | ||
- octalLiteral | ||
# We cannot control OpenAPI format | ||
- hugeParam | ||
# Types are dynamic/OpenAPI driven. | ||
- paramTypeCombine | ||
- wrapperFunc | ||
- ptrToRefParam | ||
- emptyFallthrough | ||
- nestingReduce | ||
- sloppyReassign | ||
- typeAssertChain | ||
- builtinShadow | ||
enabled-tags: | ||
- diagnostic | ||
- experimental | ||
- opinionated | ||
- performance | ||
- style | ||
gocyclo: | ||
min-complexity: 15 | ||
revive: | ||
severity: warning | ||
rules: | ||
- name: blank-imports | ||
- name: context-as-argument | ||
- name: context-keys-type | ||
- name: dot-imports | ||
- name: error-return | ||
- name: error-strings | ||
- name: error-naming | ||
- name: errorf | ||
- name: exported | ||
- name: if-return | ||
- name: increment-decrement | ||
- name: package-comments | ||
- name: range | ||
- name: time-naming | ||
- name: unexported-return | ||
- name: errorf | ||
- name: empty-block | ||
- name: superfluous-else | ||
- name: struct-tag | ||
# OpenAPI paths can have 0 parameters | ||
# - name: unused-parameter | ||
# We still want empty methods for consistency - do not control if method will be empty. | ||
# - name: unused-receiver | ||
- name: unreachable-code | ||
# We want to maintain OpenAPI consistency and ignore golang standards | ||
# - name: var-naming | ||
# - name: var-declaration | ||
# - name: receiver-naming | ||
exclusions: | ||
generated: lax | ||
presets: | ||
- comments | ||
- common-false-positives | ||
- legacy | ||
- std-error-handling | ||
rules: # Exceptions for auto-generated code from OpenAPI spec | ||
- text: "ST1023:" | ||
path: (.+)\.go$ | ||
comment: "ST1023: should omit type XXX from declaration; it will be inferred from the right-hand side (staticcheck)" | ||
- text: "QF1011:" | ||
path: (.+)\.go$ | ||
comment: "QF1011: could omit type XXX from declaration; it will be inferred from the right-hand side (staticcheck)" | ||
- text: "QF1004:" | ||
path: (.+)\.go$ | ||
comment: "QF1004: could use strings.ReplaceAll instead (staticcheck)" | ||
formatters: | ||
enable: | ||
- gofmt | ||
- goimports |
This file contains hidden or 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
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
fixes: File is not properly formatted (goimports)