-
Notifications
You must be signed in to change notification settings - Fork 38
chore: Upgrades golangci-lint to v2 #1327
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
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 |
---|---|---|
@@ -1,131 +1,107 @@ | ||
linters-settings: | ||
exhaustive: | ||
default-signifies-exhaustive: true | ||
|
||
gocritic: | ||
enabled-tags: | ||
- diagnostic | ||
- experimental | ||
- opinionated | ||
- performance | ||
- style | ||
disabled-checks: | ||
# cfn handlers generated automatically, below are exempted for the same | ||
- hugeParam | ||
- paramTypeCombine | ||
govet: | ||
enable-all: true | ||
|
||
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 | ||
- name: var-naming | ||
- name: var-declaration | ||
- name: package-comments | ||
- name: range | ||
- name: receiver-naming | ||
- name: time-naming | ||
- name: unexported-return | ||
- name: indent-error-flow | ||
- name: errorf | ||
- name: empty-block | ||
- name: superfluous-else | ||
- name: struct-tag | ||
# Too many unusued parameters, skipping this check for now | ||
#- name: unused-parameter | ||
- name: unreachable-code | ||
- name: redefines-builtin-id | ||
misspell: | ||
locale: US | ||
ignore-words: | ||
- cancelled | ||
lll: | ||
# Default is 120. '\t' is counted as 1 character. | ||
# set our project to 500, as we are adding open api field description in the schema. | ||
# also, for anyone using vscode, use the following configs: | ||
# "rewrap.wrappingColumn": 500 ... requires the rewrap plugin | ||
# "editor.rulers": [500] | ||
line-length: 500 | ||
nestif: | ||
# minimal complexity of if statements to report, 5 by default | ||
min-complexity: 7 | ||
mnd: | ||
checks: | ||
- case | ||
- operation | ||
- return | ||
funlen: | ||
lines: 360 | ||
statements: 120 | ||
version: "2" | ||
run: | ||
modules-download-mode: readonly | ||
tests: true | ||
linters: | ||
disable-all: true | ||
default: none | ||
enable: | ||
- copyloopvar | ||
- dogsled | ||
- errcheck | ||
- exhaustive | ||
- funlen | ||
- gocritic | ||
- gofmt | ||
- goimports | ||
- revive | ||
- mnd | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- lll | ||
- makezero | ||
- misspell | ||
- mnd | ||
- nakedret | ||
- noctx | ||
- nolintlint | ||
- revive | ||
- rowserrcheck | ||
- copyloopvar | ||
- staticcheck | ||
- stylecheck | ||
- typecheck | ||
- testifylint | ||
- testpackage | ||
- thelper | ||
- unconvert | ||
- unused | ||
- whitespace | ||
- thelper | ||
- testifylint | ||
- exhaustive | ||
- makezero | ||
- noctx | ||
- tenv | ||
- testpackage | ||
|
||
# don't enable: | ||
# - deadcode | ||
# - varcheck | ||
# - structcheck | ||
# - depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false] | ||
# - gocyclo # we already have funlen lint | ||
# - dupl # we have a lot of duplicate test cases | ||
# - gochecknoinits # we need the init function for the provider | ||
# - gochecknoglobals # we need some global variables | ||
# - unparam # Forces to create global variables when one variable is repeated in different functions | ||
# - goerr113 # It does not allow you to return an error, you need to save the error in a variable to do it | ||
# - goconst | ||
# - gocognit | ||
issues: | ||
exclude: | ||
- declaration of ".*" shadows declaration at line .* | ||
run: | ||
timeout: 10m | ||
tests: true | ||
build-tags: | ||
- integration | ||
modules-download-mode: readonly | ||
settings: | ||
exhaustive: | ||
default-signifies-exhaustive: true | ||
funlen: | ||
lines: 360 | ||
statements: 120 | ||
gocritic: | ||
disabled-checks: | ||
- hugeParam | ||
- paramTypeCombine | ||
enabled-tags: | ||
- diagnostic | ||
- experimental | ||
- opinionated | ||
- performance | ||
- style | ||
govet: | ||
enable-all: true | ||
lll: | ||
line-length: 500 | ||
misspell: | ||
locale: US | ||
ignore-rules: | ||
- cancelled | ||
mnd: | ||
checks: | ||
- case | ||
- operation | ||
- return | ||
nestif: | ||
min-complexity: 7 | ||
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: indent-error-flow | ||
- name: if-return | ||
- name: increment-decrement | ||
- name: var-naming | ||
- name: var-declaration | ||
- name: package-comments | ||
- name: range | ||
- name: receiver-naming | ||
- name: time-naming | ||
- name: unexported-return | ||
- name: indent-error-flow | ||
- name: errorf | ||
- name: empty-block | ||
- name: superfluous-else | ||
- name: struct-tag | ||
- name: unreachable-code | ||
- name: redefines-builtin-id | ||
exclusions: | ||
generated: lax | ||
presets: | ||
- comments | ||
- common-false-positives | ||
- legacy | ||
- std-error-handling | ||
rules: | ||
- path: (.+)\.go$ | ||
text: declaration of ".*" shadows declaration at line .* | ||
formatters: | ||
enable: | ||
- gofmt | ||
- goimports |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,9 +225,10 @@ func checkReplicationSpecs(a *assert.Assertions, replicationSpecs []admin.Replic | |
hwSpec := config.GetElectableSpecs() | ||
a.Equal(nodeCount, hwSpec.GetNodeCount()) | ||
} | ||
if i == 0 { | ||
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. fixes: QF1003: could use tagged switch on i (staticcheck) |
||
switch i { | ||
case 0: | ||
a.Equal(zone1, spec.GetZoneName()) | ||
} else if i == 1 { | ||
case 1: | ||
a.Equal(zone2, spec.GetZoneName()) | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -326,11 +326,8 @@ func modelToIntegration(currentModel *Model) (out *admin.ThridPartyIntegration) | |
} | ||
|
||
func integrationToModel(currentModel Model, integration *admin.ThridPartyIntegration) Model { | ||
enabled := 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. fixes: QF1007: could merge conditional assignment into variable declaration (staticcheck) |
||
// if "Enabled" is not set in the inputs we dont want to return "Enabled" in outputs | ||
if currentModel.Enabled != nil { | ||
enabled = true | ||
} | ||
enabled := currentModel.Enabled != nil | ||
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. This can never be 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. can be false if currentModel.Enabled == nil |
||
|
||
/* | ||
The variables from the thirdparty integration are not returned back in reposnse because most of the variables are sensitive variables. | ||
|
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: encoded-compare: use assert.JSONEq (testifylint)