2024-07-03 14:12:13 +00:00
|
|
|
# yaml-language-server: $schema=https://golangci-lint.run/jsonschema/golangci.jsonschema.json
|
|
|
|
# docs: https://github.com/golangci/golangci-lint#config-file
|
2021-09-29 15:38:50 +00:00
|
|
|
|
|
|
|
run:
|
2024-07-03 14:12:13 +00:00
|
|
|
timeout: 2m
|
2021-09-29 15:38:50 +00:00
|
|
|
modules-download-mode: readonly
|
|
|
|
allow-parallel-runners: true
|
|
|
|
|
|
|
|
output:
|
2024-07-03 14:12:13 +00:00
|
|
|
formats: [{format: colored-line-number}] # colored-line-number|line-number|json|tab|checkstyle|code-climate
|
2021-09-29 15:38:50 +00:00
|
|
|
|
|
|
|
linters-settings:
|
2024-07-03 14:12:13 +00:00
|
|
|
gci:
|
|
|
|
sections:
|
|
|
|
- standard
|
|
|
|
- default
|
|
|
|
- prefix(gh.tarampamp.am/error-pages)
|
|
|
|
gofmt:
|
|
|
|
simplify: false
|
|
|
|
rewrite-rules:
|
|
|
|
- { pattern: 'interface{}', replacement: 'any' }
|
2021-09-29 15:38:50 +00:00
|
|
|
govet:
|
2024-07-03 14:12:13 +00:00
|
|
|
enable:
|
|
|
|
- shadow
|
2021-09-29 15:38:50 +00:00
|
|
|
gocyclo:
|
|
|
|
min-complexity: 15
|
|
|
|
godot:
|
|
|
|
scope: declarations
|
2024-07-03 14:12:13 +00:00
|
|
|
capital: false
|
2021-09-29 15:38:50 +00:00
|
|
|
dupl:
|
|
|
|
threshold: 100
|
|
|
|
goconst:
|
|
|
|
min-len: 2
|
|
|
|
min-occurrences: 3
|
|
|
|
misspell:
|
|
|
|
locale: US
|
2024-07-03 14:12:13 +00:00
|
|
|
ignore-words: [cancelled]
|
2021-09-29 15:38:50 +00:00
|
|
|
lll:
|
|
|
|
line-length: 120
|
2024-07-03 14:12:13 +00:00
|
|
|
forbidigo:
|
|
|
|
forbid:
|
|
|
|
- '^(fmt\.Print(|f|ln)|print(|ln))(# it looks like a forgotten debugging printing call)?$'
|
2021-09-29 15:38:50 +00:00
|
|
|
prealloc:
|
|
|
|
simple: true
|
|
|
|
range-loops: true
|
|
|
|
for-loops: true
|
|
|
|
nolintlint:
|
|
|
|
require-specific: true
|
2024-07-03 14:12:13 +00:00
|
|
|
nakedret:
|
|
|
|
# Make an issue if func has more lines of code than this setting, and it has naked returns.
|
|
|
|
# Default: 30
|
|
|
|
max-func-lines: 100
|
2021-09-29 15:38:50 +00:00
|
|
|
|
|
|
|
linters: # All available linters list: <https://golangci-lint.run/usage/linters/>
|
|
|
|
disable-all: true
|
|
|
|
enable:
|
|
|
|
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
|
2022-01-31 08:43:40 +00:00
|
|
|
- bidichk # Checks for dangerous unicode character sequences
|
2021-09-29 15:38:50 +00:00
|
|
|
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
|
|
|
|
- dupl # Tool for code clone detection
|
|
|
|
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
|
|
|
|
- errorlint # find code that will cause problems with the error wrapping scheme introduced in Go 1.13
|
|
|
|
- exhaustive # check exhaustiveness of enum switch statements
|
|
|
|
- exportloopref # checks for pointers to enclosing loop variables
|
|
|
|
- funlen # Tool for detection of long functions
|
2024-07-03 14:12:13 +00:00
|
|
|
- gci # Gci control golang package import order and make it always deterministic
|
|
|
|
- godot # Check if comments end in a period
|
2021-09-29 15:38:50 +00:00
|
|
|
- gochecknoglobals # Checks that no globals are present in Go code
|
|
|
|
- gochecknoinits # Checks that no init functions are present in Go code
|
|
|
|
- gocognit # Computes and checks the cognitive complexity of functions
|
|
|
|
- goconst # Finds repeated strings that could be replaced by a constant
|
|
|
|
- gocritic # The most opinionated Go source code linter
|
|
|
|
- gocyclo # Computes and checks the cyclomatic complexity of functions
|
2024-07-03 14:12:13 +00:00
|
|
|
- gofmt # Gofmt checks whether code was gofmt-ed. By default, this tool runs with -s option to check for code simplification
|
|
|
|
- goimports # Goimports does everything that gofmt does. Additionally, it checks unused imports
|
|
|
|
- mnd # An analyzer to detect magic numbers
|
2021-09-29 15:38:50 +00:00
|
|
|
- goprintffuncname # Checks that printf-like functions are named with `f` at the end
|
|
|
|
- gosec # Inspects source code for security problems
|
|
|
|
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
|
|
|
|
- ineffassign # Detects when assignments to existing variables are not used
|
|
|
|
- lll # Reports long lines
|
2024-07-03 14:12:13 +00:00
|
|
|
- forbidigo # Forbids identifiers
|
2021-09-29 15:38:50 +00:00
|
|
|
- misspell # Finds commonly misspelled English words in comments
|
|
|
|
- nakedret # Finds naked returns in functions greater than a specified function length
|
|
|
|
- nestif # Reports deeply nested if statements
|
|
|
|
- nlreturn # checks for a new line before return and branch statements to increase code clarity
|
|
|
|
- nolintlint # Reports ill-formed or insufficient nolint directives
|
|
|
|
- prealloc # Finds slice declarations that could potentially be preallocated
|
2024-07-03 14:12:13 +00:00
|
|
|
- promlinter # Check Prometheus metrics naming via promlint.
|
2021-09-29 15:38:50 +00:00
|
|
|
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
|
|
|
|
- unconvert # Remove unnecessary type conversions
|
|
|
|
- whitespace # Tool for detection of leading and trailing whitespace
|
|
|
|
- wsl # Whitespace Linter - Forces you to use empty lines!
|
2024-07-03 14:12:13 +00:00
|
|
|
- unused # Checks Go code for unused constants, variables, functions and types
|
|
|
|
- gosimple # Linter for Go source code that specializes in simplifying code
|
|
|
|
- staticcheck # It's a set of rules from staticcheck
|
|
|
|
- asasalint # Check for pass []any as any in variadic func(...any)
|
|
|
|
- bodyclose # Checks whether HTTP response body is closed successfully
|
|
|
|
- contextcheck # Check whether the function uses a non-inherited context
|
|
|
|
- decorder # Check declaration order and count of types, constants, variables and functions
|
|
|
|
- dupword # Checks for duplicate words in the source code
|
|
|
|
- durationcheck # Check for two durations multiplied together
|
|
|
|
- errchkjson # Checks types passed to the json encoding functions
|
|
|
|
- errname # Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
|
2021-09-29 15:38:50 +00:00
|
|
|
|
|
|
|
issues:
|
2024-07-03 14:12:13 +00:00
|
|
|
exclude-dirs:
|
|
|
|
- .github
|
|
|
|
- .git
|
|
|
|
- tmp
|
|
|
|
- temp
|
|
|
|
- testdata
|
2021-09-29 15:38:50 +00:00
|
|
|
exclude-rules:
|
2024-07-03 14:12:13 +00:00
|
|
|
- {path: flags\.go, linters: [gochecknoglobals, lll, mnd, dupl]}
|
|
|
|
- {path: env\.go, linters: [lll, gosec]}
|
2021-09-29 15:38:50 +00:00
|
|
|
- path: _test\.go
|
|
|
|
linters:
|
|
|
|
- dupl
|
2024-07-03 14:12:13 +00:00
|
|
|
- dupword
|
|
|
|
- lll
|
|
|
|
- nolintlint
|
2021-09-29 15:38:50 +00:00
|
|
|
- funlen
|
|
|
|
- gocognit
|
2024-07-03 14:12:13 +00:00
|
|
|
- noctx
|
|
|
|
- goconst
|
|
|
|
- nlreturn
|
|
|
|
- gochecknoglobals
|