-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yml
138 lines (134 loc) · 8.81 KB
/
.golangci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
linters:
disable-all: true
enable:
- asasalint # Check for passing []any as any in variadic func(...any)
- asciicheck # Check for non-ASCII identifiers
- bidichk # Checks for dangerous unicode character sequences
- bodyclose # Checks whether HTTP response body is closed successfully
- canonicalheader # Checks whether net/http.Header uses canonical header
- containedctx # Detects struct contained context.Context field
- contextcheck # Check if a function uses a non-inherited context
- cyclop # Checks function and package cyclomatic complexity
- decorder # Check declaration order and count of types, constants, variables and functions
- dogsled # Checks assignments with too many blank identifiers
- dupl # Code clone detection
- dupword # Checks for duplicate words in the source code
- durationcheck # Check for two durations multiplied together
- err113 # Check error handling expressions
- errcheck # Checking for unchecked errors
- errchkjson # Checks types passed to the JSON encoding functions
- errname # Checks that sentinel errors are prefixed with `Err` and error types are suffixed with `Error`
- errorlint # Find code that will cause problems with error wrapping
- exhaustive # Check exhaustiveness of enum switch statements
- exportloopref # Checks for pointers to enclosing loop variables
- fatcontext # Detects nested contexts in loops
- forbidigo # Forbids identifiers
- forcetypeassert # Finds forced type assertions
- funlen # Detection of long functions
- gci # Control package import order and make it always deterministic
- ginkgolinter # Enforces standards of using ginkgo and gomega
- gocheckcompilerdirectives # Checks that go compiler directive comments (//go:) are valid
- gochecknoglobals # Checks that no globals are present
- gochecknoinits # Checks that no init functions are present in Go code
- gochecksumtype # Run exhaustiveness checks on Go "sum types"
- 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
- godot # Check if comments end in a period
- godox # Detection of FIXME, TODO and other comment keywords
- gofmt # Checks whether code was gofmt-ed
- gofumpt # Checks whether code was gofumpt-ed
- goimports # Does everything that gofmt does and checks unused imports
- gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' in go.mod
- goprintffuncname # Checks that printf-like functions are named with `f` at the end
- gosec # Inspects source code for security problems
- gosimple # Specializes in simplifying code
- gosmopolitan # Report certain i18n/l10n anti-patterns in your Go codebase
- govet # Reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
- grouper # An analyzer to analyze expression groups
- importas # Enforces consistent import aliases
- inamedparam # Reports interfaces with unnamed method parameters
- ineffassign # Detects when assignments to existing variables are not used
- interfacebloat # Checks the number of methods inside an interface
- ireturn # Accept interfaces, return concrete types
- loggercheck # Checks key value pairs for common logger libraries
- maintidx # Measures the maintainability index of each function
- makezero # Finds slice declarations with non-zero initial length
- mirror # Reports wrong mirror patterns of bytes/strings usage
- 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
- nilerr # Finds the code that returns nil even if it checks that the error is not nil
- nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value
- nlreturn # Checks for a new line before return and branch statements
- noctx # Finds sending HTTP request without context.Context
- nolintlint # Reports ill-formed or insufficient nolint directives
- nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL
- perfsprint # Checks that fmt.Sprintf can be replaced with a faster alternative
- prealloc # Finds slice declarations that could potentially be preallocated
- predeclared # Find code that shadows one of Go's predeclared identifiers
- promlinter # Check Prometheus metrics naming via promlint
- protogetter # Reports direct reads from proto message fields when getters should be used
- reassign # Checks that package variables are not reassigned
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go
- rowserrcheck # Checks whether err of rows is checked successfully
- sloglint # Ensure consistent code style when using log/slog
- spancheck # Checks for mistakes with OpenTelemetry/Census spans
- sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed
- staticcheck # Go vet on steroids, applying a ton of static analysis checks
- stylecheck # Replacement for golint
- tagalign # Checks that struct tags are well aligned
- tagliatelle # Checks the struct tags
- tenv # Detects using os.Setenv instead of t.Setenv
- testableexamples # Checks if examples are testable
- testifylint # Checks usage of github.com/stretchr/testify
- testpackage # Makes you use a separate _test package
- thelper # Detects test helpers without t.Helper() and checks the consistency of test helpers
- tparallel # Detects inappropriate usage of t.Parallel() method in Go test code
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
- unconvert # Remove unnecessary type conversions
- unparam # Reports unused function parameters
- unused # Checks for unused constants, variables, functions and types
- usestdlibvars # Detect the possibility to use variables/constants from the Go standard library
- wastedassign # Finds wasted assignment statements
- whitespace # Detection of leading and trailing whitespace
- wsl # Whitespace Linter - Forces you to use empty lines!
- zerologlint # Detects the wrong usage of `zerolog` that a user forgets to dispatch with `Send` or `Msg`
# Disabled until 1.22
#- copyloopvar # Detects places where loop variables are copied
#- intrange # Finds places where for loops could make use of an integer range
#- depguard # Checks if package imports are in a list of acceptable packages
#- exhaustruct # Checks if all structure fields are initialized
#- goheader # Checks if file header matches to pattern
#- gomodguard # Allow and block list linter for direct Go module dependencies
#- lll # Reports long lines
#- mnd # An analyzer to detect magic numbers
#- musttag # Enforce field tags in (un)marshaled structs
#- nonamedreturns # Reports all named returns
#- paralleltest # Detects missing usage of t.Parallel() method in tests
#- varnamelen # Checks that the length of a variable's name matches its scope
#- wrapcheck # Checks that errors returned from external packages are wrapped
issues:
exclude-use-default: false
linters-settings:
errcheck:
exclude-functions:
- (*kreklow.us/go/cli.TermPrinter).Eprint
- (*kreklow.us/go/cli.TermPrinter).Eprintf
- (*kreklow.us/go/cli.TermPrinter).Eprintln
- (*kreklow.us/go/cli.TermPrinter).Lprint
- (*kreklow.us/go/cli.TermPrinter).Lprintf
- (*kreklow.us/go/cli.TermPrinter).Lprintln
- (*kreklow.us/go/cli.TermPrinter).Print
- (*kreklow.us/go/cli.TermPrinter).Printf
- (*kreklow.us/go/cli.TermPrinter).Println
gosec:
excludes:
- G104
- G307
nolintlint:
allow-unused: false
allow-leading-space: false
require-explanation: true
require-specific: true