-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add golangci-lint config and fix linter errors (#353)
* Add golangci-lint and fixes * Use consistent line breaks on AddCommand * Correct some load balancer command docs * Update workflows to use go v1.21 * Add exclude rules to printer functions The errors will be addressed in another, more complicated changeset * Remove unecessary whitespace * Remove obsolete nolint directive
- Loading branch information
1 parent
289dba0
commit 20f4990
Showing
35 changed files
with
668 additions
and
197 deletions.
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
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
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
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 |
---|---|---|
@@ -0,0 +1,135 @@ | ||
linters-settings: | ||
dupl: | ||
threshold: 300 | ||
funlen: | ||
lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. | ||
statements: 50 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 3 | ||
gocritic: | ||
enabled-tags: | ||
- diagnostic | ||
- experimental | ||
- opinionated | ||
- performance | ||
- style | ||
disabled-checks: | ||
- dupImport # https://github.com/go-critic/go-critic/issues/845 | ||
- ifElseChain | ||
- octalLiteral | ||
- whyNoLint | ||
gocyclo: | ||
min-complexity: 15 | ||
goimports: | ||
local-prefixes: github.com/golangci/golangci-lint | ||
gomnd: | ||
# don't include the "operation" and "assign" | ||
checks: | ||
- argument | ||
- case | ||
- condition | ||
- return | ||
ignored-numbers: | ||
- '0' | ||
- '1' | ||
- '2' | ||
- '3' | ||
ignored-functions: | ||
- strings.SplitN | ||
|
||
govet: | ||
check-shadowing: true | ||
settings: | ||
printf: | ||
funcs: | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf | ||
lll: | ||
line-length: 140 | ||
misspell: | ||
locale: US | ||
nolintlint: | ||
allow-unused: false # report any unused nolint directives | ||
require-explanation: false # don't require an explanation for nolint directives | ||
require-specific: false # don't require nolint directives to be specific about which linter is being skipped | ||
revive: | ||
rules: | ||
- name: unexported-return | ||
disabled: true | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- dogsled | ||
- dupl | ||
- errcheck | ||
- exportloopref | ||
- funlen | ||
- gocritic | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- gomnd | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- lll | ||
- misspell | ||
- nakedret | ||
- noctx | ||
- nolintlint | ||
- revive | ||
- staticcheck | ||
- stylecheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- whitespace | ||
|
||
# don't enable: | ||
# - bodyclose | ||
# - depguard | ||
# - asciicheck | ||
# - scopelint | ||
# - gochecknoglobals | ||
# - gocognit | ||
# - godot | ||
# - godox | ||
# - goerr113 | ||
# - interfacer | ||
# - maligned | ||
# - nestif | ||
# - prealloc | ||
# - testpackage | ||
# - wsl | ||
|
||
issues: | ||
# List of regexps of issue texts to exclude. | ||
# | ||
# But independently of this option we use default exclude patterns, | ||
# it can be disabled by `exclude-use-default: false`. | ||
# To list all excluded by default patterns execute `golangci-lint run --help` | ||
# | ||
# Default: https://golangci-lint.run/usage/false-positives/#default-exclusions | ||
exclude: | ||
- abcdef | ||
exclude-rules: | ||
# Exclude some linters from running on tests files. | ||
- path: cmd/printer/ | ||
linters: | ||
- funlen | ||
- gocyclo | ||
- dupl | ||
- lll | ||
- gomnd | ||
- gocritic | ||
- stylecheck | ||
|
||
run: | ||
timeout: 5m |
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
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
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
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
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
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
Oops, something went wrong.