2022-10-26 13:11:37 +00:00
# https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml
2022-05-25 20:27:50 +00:00
run :
skip-dirs :
- pkg/time/rate
skip-files :
- pkg/database/ent/generate.go
2022-11-29 08:16:07 +00:00
- pkg/yamlpatch/merge.go
2022-10-14 14:12:21 +00:00
- pkg/yamlpatch/merge_test.go
2022-05-25 20:27:50 +00:00
linters-settings :
gocyclo :
min-complexity : 30
funlen :
# Checks the number of lines in a function.
# If lower than 0, disable the check.
# Default: 60
lines : -1
# Checks the number of statements in a function.
# If lower than 0, disable the check.
# Default: 40
statements : -1
govet :
check-shadowing : true
2022-10-26 13:11:37 +00:00
2022-05-25 20:27:50 +00:00
lll :
line-length : 140
2022-10-26 13:11:37 +00:00
2022-05-25 20:27:50 +00:00
misspell :
locale : US
2022-10-26 13:11:37 +00:00
2022-05-25 20:27:50 +00:00
nolintlint :
allow-leading-space : true # don't require machine-readable nolint directives (i.e. with no leading space)
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
2022-10-26 13:11:37 +00:00
interfacebloat :
max : 12
2022-05-25 20:27:50 +00:00
linters :
enable-all : true
disable :
#
# DEPRECATED by golangi-lint
#
2022-09-06 11:55:03 +00:00
- deadcode # The owner seems to have abandoned the linter. Replaced by unused.
2022-06-06 13:24:48 +00:00
- exhaustivestruct # The owner seems to have abandoned the linter. Replaced by exhaustruct.
- golint # Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes
2022-09-06 11:55:03 +00:00
- ifshort # Checks that your code uses short syntax for if-statements whenever possible
2022-06-06 13:24:48 +00:00
- interfacer # Linter that suggests narrower interface types
- maligned # Tool to detect Go structs that would take less memory if their fields were sorted
2022-09-06 11:55:03 +00:00
- nosnakecase # nosnakecase is a linter that detects snake case of variable naming and function name.
2022-06-06 13:24:48 +00:00
- scopelint # Scopelint checks for unpinned variables in go programs
2022-09-06 11:55:03 +00:00
- structcheck # The owner seems to have abandoned the linter. Replaced by unused.
- varcheck # The owner seems to have abandoned the linter. Replaced by unused.
2022-05-25 20:27:50 +00:00
#
# Enabled
#
2022-09-06 11:55:03 +00:00
2022-08-16 07:46:10 +00:00
# - asasalint # check for pass []any as any in variadic func(...any)
2022-05-25 20:27:50 +00:00
# - asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
# - bidichk # Checks for dangerous unicode character sequences
# - decorder # check declaration order and count of types, constants, variables and functions
# - depguard # Go linter that checks if package imports are in a list of acceptable packages
2022-10-26 13:11:37 +00:00
# - dupword # checks for duplicate words in the source code
2022-05-25 20:27:50 +00:00
# - durationcheck # check for two durations multiplied together
2022-09-06 11:55:03 +00:00
# - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
2022-05-25 20:27:50 +00:00
# - exportloopref # checks for pointers to enclosing loop variables
# - funlen # Tool for detection of long functions
# - gochecknoinits # Checks that no init functions are present in Go code
2022-11-07 09:36:50 +00:00
# - gocritic # Provides diagnostics that check for bugs, performance and style issues.
2022-05-25 20:27:50 +00:00
# - goheader # Checks is file header matches to pattern
# - gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.
# - gomodguard # Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations.
# - goprintffuncname # Checks that printf-like functions are named with `f` at the end
2022-09-06 11:55:03 +00:00
# - gosimple # (megacheck): Linter for Go source code that specializes in simplifying a code
# - govet # (vet, vetshadow): Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
2022-05-25 20:27:50 +00:00
# - grouper # An analyzer to analyze expression groups.
# - importas # Enforces consistent import aliases
2022-09-06 11:55:03 +00:00
# - ineffassign # Detects when assignments to existing variables are not used
# - interfacebloat # A linter that checks the number of methods inside an interface.
# - logrlint # Check logr arguments.
2022-05-25 20:27:50 +00:00
# - makezero # Finds slice declarations with non-zero initial length
2022-06-16 12:41:54 +00:00
# - misspell # Finds commonly misspelled English words in comments
2022-11-07 09:36:50 +00:00
# - nilerr # Finds the code that returns nil even if it checks that the error is not nil.
2022-05-25 20:27:50 +00:00
# - nolintlint # Reports ill-formed or insufficient nolint directives
2022-06-16 12:41:54 +00:00
# - predeclared # find code that shadows one of Go's predeclared identifiers
2022-09-06 11:55:03 +00:00
# - reassign # Checks that package variables are not reassigned
2022-05-25 20:27:50 +00:00
# - rowserrcheck # checks whether Err of rows is checked successfully
# - sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed.
2022-09-06 11:55:03 +00:00
# - staticcheck # (megacheck): Staticcheck is a go vet on steroids, applying a ton of static analysis checks
2022-10-26 13:11:37 +00:00
# - testableexamples # linter checks if examples are testable (have an expected output)
2022-05-25 20:27:50 +00:00
# - tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
# - tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes
# - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
2022-06-16 12:41:54 +00:00
# - unconvert # Remove unnecessary type conversions
2022-09-06 11:55:03 +00:00
# - unused # (megacheck): Checks Go code for unused constants, variables, functions and types
2022-08-16 07:46:10 +00:00
# - usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library.
2022-05-25 20:27:50 +00:00
#
# Recommended? (easy)
#
2022-09-06 11:55:03 +00:00
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
2022-05-25 20:27:50 +00:00
- errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and optionally reports occations, where the check for the returned error can be omitted.
- 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.
2022-09-06 11:55:03 +00:00
- exhaustive # check exhaustiveness of enum switch statements
2022-05-25 20:27:50 +00:00
- gci # Gci control golang package import order and make it always deterministic.
2022-09-06 11:55:03 +00:00
- godot # Check if comments end in a period
2022-05-25 20:27:50 +00:00
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
- goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt.
- gosec # (gas) : Inspects source code for security problems
2022-09-06 11:55:03 +00:00
- lll # Reports long lines
2022-05-25 20:27:50 +00:00
- nakedret # Finds naked returns in functions greater than a specified function length
2022-06-06 13:24:48 +00:00
- nonamedreturns # Reports all named returns
2022-06-16 12:41:54 +00:00
- nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL.
2022-05-25 20:27:50 +00:00
- promlinter # Check Prometheus metrics naming via promlint
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
- thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers
2022-09-06 11:55:03 +00:00
- wastedassign # wastedassign finds wasted assignment statements.
2022-05-25 20:27:50 +00:00
- wrapcheck # Checks that errors returned from external packages are wrapped
#
# Recommended? (requires some work)
#
- bodyclose # checks whether HTTP response body is closed successfully
- containedctx # containedctx is a linter that detects struct contained context.Context field
- contextcheck # check the function whether use a non-inherited context
- errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`.
- gomnd # An analyzer to detect magic numbers.
- ireturn # Accept Interfaces, Return Concrete Types
2022-09-06 11:55:03 +00:00
- nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value.
- noctx # noctx finds sending http request without context.Context
- unparam # Reports unused function parameters
2022-05-25 20:27:50 +00:00
#
# Formatting only, useful in IDE but should not be forced on CI?
#
- gofumpt # Gofumpt checks whether code was gofumpt-ed.
- nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity
- whitespace # Tool for detection of leading and trailing whitespace
- wsl # Whitespace Linter - Forces you to use empty lines!
#
# Well intended, but not ready for this
#
- cyclop # checks function and package cyclomatic complexity
2022-09-06 11:55:03 +00:00
- dupl # Tool for code clone detection
2022-10-14 14:12:21 +00:00
- forcetypeassert # finds forced type assertions
2022-05-25 20:27:50 +00:00
- gocognit # Computes and checks the cognitive complexity of functions
- gocyclo # Computes and checks the cyclomatic complexity of functions
- godox # Tool for detection of FIXME, TODO and other comment keywords
2022-09-06 11:55:03 +00:00
- goerr113 # Golang linter to check the errors handling expressions
- maintidx # maintidx measures the maintainability index of each function.
- nestif # Reports deeply nested if statements
- paralleltest # paralleltest detects missing usage of t.Parallel() method in your Go test
2022-05-25 20:27:50 +00:00
- testpackage # linter that makes you use a separate _test package
#
2022-06-06 13:24:48 +00:00
# Too strict / too many false positives (for now?)
2022-05-25 20:27:50 +00:00
#
2022-06-06 13:24:48 +00:00
- execinquery # execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds
2022-09-06 11:55:03 +00:00
- exhaustruct # Checks if all structure fields are initialized
2022-05-25 20:27:50 +00:00
- forbidigo # Forbids identifiers
- gochecknoglobals # check that no global variables exist
- goconst # Finds repeated strings that could be replaced by a constant
- stylecheck # Stylecheck is a replacement for golint
2022-09-06 11:55:03 +00:00
- tagliatelle # Checks the struct tags.
- varnamelen # checks that the length of a variable's name matches its scope
2022-05-25 20:27:50 +00:00
#
# Under evaluation
#
- prealloc # Finds slice declarations that could potentially be preallocated
2022-10-26 13:11:37 +00:00
2022-05-25 20:27:50 +00:00
issues :
2022-06-21 12:53:51 +00:00
# “Look, that’ s why there’ s rules, understand? So that you think before you
# break ‘ em.” ― Terry Pratchett
2022-06-16 12:41:54 +00:00
max-issues-per-linter : 0
max-same-issues : 10
2022-05-25 20:27:50 +00:00
exclude-rules :
- path : go.mod
text : "replacement are not allowed: golang.org/x/time/rate"
# `err` is often shadowed, we may continue to do it
- linters :
- govet
text : "shadow: declaration of \"err\" shadows declaration"
#
# errcheck
#
- linters :
- errcheck
text : "Error return value of `.*` is not checked"
2022-11-07 09:36:50 +00:00
#
# gocritic
#
- linters :
- gocritic
text : "ifElseChain: rewrite if-else to switch statement"
- linters :
- gocritic
text : "captLocal: `.*' should not be capitalized"
- linters :
- gocritic
text : "appendAssign: append result not assigned to the same slice"
- linters :
- gocritic
text : "commentFormatting: put a space between `//` and comment text"