|
1 |
| -linters-settings: |
2 |
| - gocritic: |
3 |
| - enabled-tags: |
4 |
| - - diagnostic |
5 |
| - - experimental |
6 |
| - - opinionated |
7 |
| - - performance |
8 |
| - - style |
9 |
| - disabled-checks: |
10 |
| - - dupImport |
11 |
| - - ifElseChain |
12 |
| - - octalLiteral |
13 |
| - - whyNoLint |
14 |
| - - wrapperFunc |
15 |
| - - exitAfterDefer |
16 |
| - - hugeParam |
17 |
| - - ptrToRefParam |
18 |
| - - paramTypeCombine |
19 |
| - - unnamedResult |
| 1 | +run: |
| 2 | + # Timeout for analysis, e.g. 30s, 5m. |
| 3 | + # Default: 1m |
| 4 | + timeout: 3m |
| 5 | + |
20 | 6 | linters:
|
21 |
| - disable-all: true |
22 | 7 | enable:
|
23 |
| - # default linters |
24 |
| - - errcheck |
25 |
| - - gosimple |
26 |
| - - govet |
27 |
| - - ineffassign |
28 |
| - - staticcheck |
29 |
| - - typecheck |
30 |
| - - unused |
31 |
| - # additional linters |
32 |
| - - asasalint |
33 |
| - - asciicheck |
34 |
| - - bidichk |
35 |
| - - bodyclose |
36 |
| - - containedctx |
37 |
| - - contextcheck |
38 |
| - - decorder |
39 |
| - - dupl |
40 |
| - - durationcheck |
41 |
| - - errchkjson |
42 |
| - - errname |
43 |
| - - errorlint |
44 |
| - - exhaustive |
45 |
| - - exhaustruct |
46 |
| - - exportloopref |
47 |
| - - forcetypeassert |
48 |
| - - gocheckcompilerdirectives |
49 |
| - - gocritic |
50 |
| - - godot |
51 |
| - - godox |
52 |
| - - goerr113 |
53 |
| - - gofmt |
54 |
| - - goprintffuncname |
55 |
| - - gosec |
56 |
| - - gosmopolitan |
57 |
| - - importas |
58 |
| - - ireturn |
59 |
| - - nakedret |
60 |
| - - nestif |
61 |
| - - nilerr |
62 |
| - - nilnil |
63 |
| - - prealloc |
64 |
| - - predeclared |
65 |
| - - revive |
66 |
| - - rowserrcheck |
67 |
| - - tagalign |
68 |
| - - tenv |
69 |
| - - thelper |
70 |
| - - tparallel |
71 |
| - - unconvert |
72 |
| - - unparam |
73 |
| - - usestdlibvars |
74 |
| - - wastedassign |
75 |
| - - whitespace |
76 |
| - - wrapcheck |
77 |
| - - wsl |
78 |
| - - gocyclo |
79 |
| - - misspell |
| 8 | + - errcheck # check for unchecked errors |
| 9 | + - gosimple # specializes in simplifying code |
| 10 | + - govet # roughly the same as go vet |
| 11 | + - ineffassign # detects when assignments to existing variables are not used |
| 12 | + - staticcheck # staticcheck is a go vet on steroids, applying static analysis to your code |
| 13 | + - unused # finds unused variables and constants |
| 14 | + - asasalint # check `any` variadic funcs |
| 15 | + - asciicheck # check for non-ASCII characters |
| 16 | + - bidichk # check for dangerous unicode character sequences |
| 17 | + - bodyclose # check that HTTP response body is closed |
| 18 | + - canonicalheader # check that canonical headers are used |
| 19 | + - containedctx # detects struct contained context.Context field |
| 20 | + - contextcheck # check whether the function uses a non-inherited context |
| 21 | + - decorder # check declaration order and count of types, constants, variables and functions |
| 22 | + - dupl # finds duplicated code |
| 23 | + - durationcheck # check for two durations multiplied together |
| 24 | + - err113 # check the errors handling expressions |
| 25 | + - errchkjson # checks types passed to the json encoding functions |
| 26 | + - errname # check error names |
| 27 | + - errorlint # check error wrapping |
| 28 | + - exhaustive # check that all enum cases are handled |
| 29 | + - exportloopref # checks for pointers to enclosing loop variables |
| 30 | + - fatcontext # detects nested contexts in loops |
| 31 | + - forcetypeassert # finds unchecked type assertions |
| 32 | + - funlen # check for long functions |
| 33 | + - gci # controls Go package import order and makes it always deterministic |
| 34 | + - gocheckcompilerdirectives # checks that go compiler directive comments (//go:) are valid |
| 35 | + - gochecknoglobals # checks that no globals are used |
| 36 | + - gochecksumtype # exhaustiveness checks on Go "sum types" |
| 37 | + - gocognit # check for high cognitive complexity |
| 38 | + - gocritic # Go source code linter that provides a ton of rules |
| 39 | + - gocyclo # checks cyclomatic complexity |
| 40 | + - gofmt # checks whether code was gofmt-ed |
| 41 | + - gofumpt # checks whether code was gofumpt-ed |
| 42 | + - goimports # check import statements are formatted according to the 'goimport' command |
| 43 | + - goprintffuncname # checks that printf-like functions are named with f at the end |
| 44 | + - gosec # inspects source code for security problems |
| 45 | + - gosmopolitan # report certain i18n/l10n anti-patterns in your Go codebase |
| 46 | + - inamedparam # reports interfaces with unnamed method parameters |
| 47 | + - interfacebloat # check for large interfaces |
| 48 | + - intrange # find places where for loops could make use of an integer range |
| 49 | + - ireturn # Accept Interfaces, Return Concrete Types. |
| 50 | + - lll # check for long lines |
| 51 | + - maintidx # measures the maintainability index of each function |
| 52 | + - mirror # reports wrong mirror patterns of bytes/strings usage |
| 53 | + - misspell # finds commonly misspelled English words |
| 54 | + - musttag # enforce field tags in (un)marshaled structs |
| 55 | + - nakedret # checks that functions with naked returns are not longer than a maximum size |
| 56 | + - nestif # reports deeply nested if statements |
| 57 | + - nilerr # finds code that returns nil even if it checks that the error is not nil |
| 58 | + - nilnil # checks that there is no simultaneous return of nil error and an invalid value |
| 59 | + - nlreturn # checks for a new line before return and branch statements to increase code clarity |
| 60 | + - nolintlint # reports ill-formed or insufficient nolint directives |
| 61 | + - nosprintfhostport # checks for misuse of Sprintf to construct a host with port in a URL |
| 62 | + - paralleltest # detects missing usage of t.Parallel() method in your Go test |
| 63 | + - perfsprint # checks that fmt.Sprintf can be replaced with a faster alternative |
| 64 | + - prealloc # finds slice declarations that could potentially be pre-allocated |
| 65 | + - predeclared # finds code that shadows one of Go's predeclared identifiers |
| 66 | + - promlinter # checks Prometheus metrics naming via promlint |
| 67 | + - protogetter # reports direct reads from proto message fields when getters should be used |
| 68 | + - reassign # checks that package variables are not reassigned |
| 69 | + - revive # drop-in replacement of golint. |
| 70 | + - rowserrcheck # checks whether Rows.Err of rows is checked successfully |
| 71 | + - sloglint # ensures consistent code style when using log/slog |
| 72 | + - spancheck # checks for mistakes with OpenTelemetry/Census spans |
| 73 | + - sqlclosecheck # checks that sql.Rows, sql.Stmt, sqlx.NamedStmt, pgx.Query are closed |
| 74 | + - stylecheck # replacement for golint |
| 75 | + - tagalign # checks that struct tags are well aligned |
| 76 | + - tagliatelle # checks the struct tags |
| 77 | + - tenv # analyzer that detects using os.Setenv instead of t.Setenv |
| 78 | + - thelper # detects tests helpers which is not start with t.Helper() method |
| 79 | + - tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes |
| 80 | + - unconvert # unnecessary type conversions |
| 81 | + - usestdlibvars # detects the possibility to use variables/constants from the Go standard library |
| 82 | + - varnamelen # checks that the length of a variable's name matches its scope |
| 83 | + - wastedassign # finds wasted assignment statements |
| 84 | + - whitespace # checks for unnecessary newlines at the start and end of functions, if, for, etc |
| 85 | + - wrapcheck # checks that errors returned from external packages are wrapped |
| 86 | + - wsl # add or remove empty lines |
| 87 | + |
| 88 | + disable: |
| 89 | + - copyloopvar # fixed in go 1.22+ |
| 90 | + - depguard # no forbidden imports |
| 91 | + - dogsled # blank identifiers are allowed |
| 92 | + - dupword # duplicate words are allowed |
| 93 | + - exhaustruct # many structs don't need to be exhaustive |
| 94 | + - forbidigo # no forbidden identifiers |
| 95 | + - ginkgolinter # not used |
| 96 | + - gochecknoinits # init functions are fine, if used carefully |
| 97 | + - goconst # many false positives |
| 98 | + - godot # comments don't need to be complete sentences |
| 99 | + - godox # todo comments are allowed |
| 100 | + - goheader # no need for a header |
| 101 | + - gomoddirectives # allow all directives |
| 102 | + - gomodguard # no forbidden imports |
| 103 | + - grouper # unused |
| 104 | + - importas # some aliases are fine |
| 105 | + - loggercheck # no slog support |
| 106 | + - makezero # make with non-zero initial length is fine |
| 107 | + - noctx # http request may be sent without context |
| 108 | + - nonamedreturns # named returns are fine |
| 109 | + - testableexamples # examples do not need to be testable (have declared output) |
| 110 | + - testifylint # testify is not recommended |
| 111 | + - testpackage # not a go best practice |
| 112 | + - unparam # interfaces can enforce parameters |
| 113 | + - zerologlint # slog should be used instead of zerlog |
| 114 | + - execinquery # deprecated |
| 115 | + - gomnd # deprecated |
| 116 | + - mnd # too many detections |
| 117 | + - cyclop # covered by gocyclo |
| 118 | + |
| 119 | +linters-settings: |
| 120 | + wsl: |
| 121 | + allow-cuddle-declarations: true |
| 122 | + force-err-cuddling: true |
| 123 | + force-case-trailing-whitespace: 3 |
| 124 | + |
| 125 | + funlen: |
| 126 | + lines: 100 |
| 127 | + statements: 50 |
| 128 | + ignore-comments: true |
| 129 | + |
| 130 | + lll: |
| 131 | + line-length: 140 |
| 132 | + tab-width: 1 |
| 133 | + |
| 134 | + varnamelen: |
| 135 | + ignore-type-assert-ok: true # ignore "ok" variables |
| 136 | + ignore-map-index-ok: true |
| 137 | + ignore-chan-recv-ok: true |
| 138 | + ignore-decls: |
| 139 | + - n int |
| 140 | + - x int |
| 141 | + - y int |
| 142 | + - z int |
| 143 | + - i int |
| 144 | + - a int |
| 145 | + - b int |
| 146 | + - c int |
| 147 | + - j int |
| 148 | + - T any |
| 149 | + - t testing.T |
| 150 | + - b testing.B |
| 151 | + |
80 | 152 | issues:
|
81 |
| - include: |
82 |
| - - EXC0012 |
83 |
| - - EXC0014 |
84 | 153 | exclude-rules:
|
85 |
| - - path: _test\.go |
| 154 | + - path: "_test(_[^/]+)?\\.go" |
86 | 155 | linters:
|
87 |
| - - gocyclo |
88 |
| - - errcheck |
| 156 | + - gochecknoglobals |
| 157 | + - noctx |
| 158 | + - funlen |
89 | 159 | - dupl
|
90 |
| - - gosec |
91 |
| - - gocritic |
92 |
| - - linters: |
93 |
| - - gocritic |
94 |
| - text: "unnecessaryDefer:" |
95 |
| - - linters: |
96 |
| - - gocritic |
97 |
| - text: "preferDecodeRune:" |
98 |
| -service: |
99 |
| - golangci-lint-version: 1.53.x |
|
0 commit comments