|
1 | | -# options for analysis running |
2 | | -run: |
3 | | - # timeout for analysis, e.g. 30s, 5m, default is 1m |
4 | | - timeout: 1m |
5 | | - go: "1.24.1" |
6 | | - |
7 | | -issues: |
8 | | - # Maximum count of issues with the same text. |
9 | | - # Set to 0 to disable. |
10 | | - # Default: 3 |
11 | | - max-same-issues: 0 |
12 | | - # Maximum issues count per one linter. |
13 | | - # Set to 0 to disable. |
14 | | - # Default: 50 |
15 | | - max-issues-per-linter: 0 |
16 | | - |
17 | | -output: |
18 | | - sort-results: true |
| 1 | +version: "2" |
19 | 2 |
|
20 | 3 | # Find the whole list here https://golangci-lint.run/usage/linters/ |
21 | 4 | linters: |
22 | | - disable-all: true |
| 5 | + default: none |
23 | 6 | enable: |
24 | | - - errcheck # checking for unchecked errors in go programs |
25 | | - - 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. |
26 | | - - forbidigo # forbids identifiers matched by reg exps |
27 | | - - gomoddirectives # manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. |
28 | | - - misspell # finds commonly misspelled English words in comments |
29 | | - - nakedret # finds naked returns in functions greater than a specified function length |
30 | | - - nolintlint # reports ill-formed or insufficient nolint directives |
31 | | - - unused # checks Go code for unused constants, variables, functions and types |
32 | | - - govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string |
33 | | - - ineffassign # detects when assignments to existing variables are not used |
34 | | - - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code |
35 | | - - asciicheck # simple linter to check that your code does not contain non-ASCII identifiers |
36 | | - - bodyclose # checks whether HTTP response body is closed successfully |
37 | | - - durationcheck # check for two durations multiplied together |
38 | | - - goimports # Goimports does everything that gofmt does. Additionally it checks unused imports |
39 | | - - gosec # inspects source code for security problems |
40 | | - - importas # enforces consistent import aliases |
41 | | - - nilerr # finds the code that returns nil even if it checks that the error is not nil. |
42 | | - - noctx # noctx finds sending http request without context.Context |
43 | | - - unconvert # Remove unnecessary type conversions |
44 | | - - wastedassign # wastedassign finds wasted assignment statements. |
45 | | - - gomodguard # check for blocked dependencies in go.mod |
46 | | - - depguard # check for blocked dependencies in Go files |
47 | | - - copyloopvar |
48 | | - |
49 | | -# all available settings of specific linters |
50 | | -linters-settings: |
51 | | - errcheck: |
52 | | - # report about not checking of errors in type assertions: `a := b.(MyStruct)`; |
53 | | - check-type-assertions: true |
54 | | - # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`. |
55 | | - check-blank: false |
56 | | - # List of functions to exclude from checking, where each entry is a single function to exclude. |
57 | | - # See https://github.com/kisielk/errcheck#excluding-functions for details. |
58 | | - exclude-functions: |
59 | | - - (mapstr.M).Delete # Only returns ErrKeyNotFound, can safely be ignored. |
60 | | - - (mapstr.M).Put # Can only fail on type conversions, usually safe to ignore. |
61 | | - |
62 | | - errorlint: |
63 | | - # Check whether fmt.Errorf uses the %w verb for formatting errors. See the readme for caveats |
64 | | - errorf: true |
65 | | - # Check for plain type assertions and type switches |
66 | | - asserts: true |
67 | | - # Check for plain error comparisons |
68 | | - comparison: true |
69 | | - |
70 | | - forbidigo: |
71 | | - # Forbid the following identifiers |
72 | | - forbid: |
73 | | - - fmt.Print.* # too much log noise |
74 | | - # Exclude godoc examples from forbidigo checks. Default is true. |
75 | | - exclude_godoc_examples: true |
76 | | - |
77 | | - gomoddirectives: |
78 | | - # Allow local `replace` directives. Default is false. |
79 | | - replace-local: false |
80 | | - |
81 | | - nakedret: |
82 | | - # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 |
83 | | - max-func-lines: 0 |
84 | | - |
85 | | - nolintlint: |
86 | | - # Enable to ensure that nolint directives are all used. Default is true. |
87 | | - allow-unused: false |
88 | | - # Disable to ensure that nolint directives don't have a leading space. Default is true. |
89 | | - allow-leading-space: false |
90 | | - # Exclude following linters from requiring an explanation. Default is []. |
91 | | - allow-no-explanation: [] |
92 | | - # Enable to require an explanation of nonzero length after each nolint directive. Default is false. |
93 | | - require-explanation: true |
94 | | - # Enable to require nolint directives to mention the specific linter being suppressed. Default is false. |
95 | | - require-specific: true |
96 | | - |
97 | | - gomodguard: |
98 | | - blocked: |
99 | | - # List of blocked modules. |
100 | | - modules: |
101 | | - # Blocked module. |
102 | | - - github.com/pkg/errors: |
103 | | - # Recommended modules that should be used instead. (Optional) |
104 | | - recommendations: |
105 | | - - errors |
106 | | - - fmt |
107 | | - reason: "This package is deprecated, use fmt.Errorf with %%w instead" |
108 | | - - github.com/elastic/beats/v7: |
109 | | - reason: "There must be no Beats dependency" |
110 | | - |
111 | | - depguard: |
112 | | - rules: |
113 | | - main: |
114 | | - list-mode: lax |
115 | | - deny: |
116 | | - - pkg: "math/rand$" |
117 | | - desc: "superseded by math/rand/v2" |
118 | | - |
119 | | - unused: |
| 7 | + - asciicheck |
| 8 | + - bodyclose |
| 9 | + - depguard |
| 10 | + - durationcheck |
| 11 | + - errcheck |
| 12 | + - errorlint |
| 13 | + - forbidigo |
| 14 | + - gomoddirectives |
| 15 | + - gomodguard |
| 16 | + - gosec |
| 17 | + - govet |
| 18 | + - importas |
| 19 | + - ineffassign |
| 20 | + - misspell |
| 21 | + - nakedret |
| 22 | + - nilerr |
| 23 | + - noctx |
| 24 | + - nolintlint |
| 25 | + - staticcheck |
| 26 | + - unconvert |
| 27 | + - unused |
| 28 | + - wastedassign |
| 29 | + settings: |
| 30 | + depguard: |
| 31 | + rules: |
| 32 | + main: |
| 33 | + list-mode: lax |
| 34 | + deny: |
| 35 | + - pkg: math/rand$ |
| 36 | + desc: superseded by math/rand/v2 |
| 37 | + errcheck: |
| 38 | + check-type-assertions: true |
| 39 | + check-blank: false |
| 40 | + exclude-functions: |
| 41 | + - (mapstr.M).Delete |
| 42 | + - (mapstr.M).Put |
| 43 | + errorlint: |
| 44 | + errorf: true |
| 45 | + asserts: true |
| 46 | + comparison: true |
| 47 | + forbidigo: |
| 48 | + forbid: |
| 49 | + - pattern: fmt.Print.* # too much log noise |
| 50 | + exclude-godoc-examples: true |
| 51 | + gomoddirectives: |
| 52 | + replace-local: false |
| 53 | + gomodguard: |
| 54 | + blocked: |
| 55 | + modules: |
| 56 | + - github.com/pkg/errors: |
| 57 | + recommendations: |
| 58 | + - errors |
| 59 | + - fmt |
| 60 | + reason: This package is deprecated, use fmt.Errorf with %%w instead |
| 61 | + - github.com/elastic/beats/v7: |
| 62 | + reason: There must be no Beats dependency |
| 63 | + gosec: |
| 64 | + excludes: |
| 65 | + - G306 # Expect WriteFile permissions to be 0600 or less |
| 66 | + - G404 # Use of weak random number generator |
| 67 | + - G401 # Detect the usage of DES, RC4, MD5 or SHA1: Used in non-crypto contexts. |
| 68 | + - G501 # Import blocklist: crypto/md5: Used in non-crypto contexts. |
| 69 | + - G505 # Import blocklist: crypto/sha1: Used in non-crypto contexts. |
| 70 | + nolintlint: |
| 71 | + require-explanation: true |
| 72 | + require-specific: true |
| 73 | + allow-unused: false |
| 74 | + staticcheck: |
| 75 | + checks: |
| 76 | + - all |
| 77 | + exclusions: |
| 78 | + generated: lax |
| 79 | + presets: |
| 80 | + - comments |
| 81 | + - common-false-positives |
| 82 | + - legacy |
| 83 | + - std-error-handling |
| 84 | + paths: |
| 85 | + - third_party$ |
| 86 | + - builtin$ |
| 87 | + - examples$ |
| 88 | +issues: |
| 89 | + max-issues-per-linter: 0 |
| 90 | + max-same-issues: 0 |
120 | 91 |
|
121 | | - gosec: |
122 | | - excludes: |
123 | | - - G306 # Expect WriteFile permissions to be 0600 or less |
124 | | - - G404 # Use of weak random number generator |
125 | | - - G401 # Detect the usage of DES, RC4, MD5 or SHA1: Used in non-crypto contexts. |
126 | | - - G501 # Import blocklist: crypto/md5: Used in non-crypto contexts. |
127 | | - - G505 # Import blocklist: crypto/sha1: Used in non-crypto contexts. |
| 92 | +formatters: |
| 93 | + enable: |
| 94 | + - goimports |
| 95 | + exclusions: |
| 96 | + generated: lax |
| 97 | + paths: |
| 98 | + - third_party$ |
| 99 | + - builtin$ |
| 100 | + - examples$ |
0 commit comments