|
1 | | -# Tested with golangci-lint ver. 1.37 |
| 1 | +# Tested with golangci-lint ver. 2.x |
| 2 | +version: "2" |
| 3 | + |
2 | 4 | run: |
3 | 5 | timeout: 10m |
4 | | -linters-settings: |
5 | | - depguard: |
6 | | - rules: |
7 | | - main: |
8 | | - deny: |
9 | | - - pkg: github.com/sirupsen/logrus |
10 | | - desc: "logging is allowed only by logutils.Log" |
11 | | - dupl: |
12 | | - threshold: 100 |
13 | | - funlen: |
14 | | - lines: 100 |
15 | | - statements: 50 |
16 | | - goconst: |
17 | | - min-len: 2 |
18 | | - min-occurrences: 2 |
19 | | - ignore-tests: true |
20 | | - gocritic: |
21 | | - enabled-tags: |
22 | | - - diagnostic |
23 | | - - experimental |
24 | | - - opinionated |
25 | | - - performance |
26 | | - - style |
27 | | - disabled-checks: |
28 | | - - dupImport # https://github.com/go-critic/go-critic/issues/845 |
29 | | - - ifElseChain |
30 | | - - octalLiteral |
31 | | - - whyNoLint |
32 | | - - wrapperFunc |
33 | | - - unnamedResult |
34 | | - settings: |
35 | | - hugeParam: |
36 | | - sizeThreshold: 512 |
37 | | - rangeValCopy: |
38 | | - sizeThreshold: 512 |
39 | | - gocyclo: |
40 | | - min-complexity: 15 |
41 | | - goimports: |
42 | | - local-prefixes: github.com/k8snetworkplumbingwg/sriov-network-operator |
43 | | - gomnd: |
44 | | - settings: |
45 | | - mnd: |
46 | | - # don't include the "operation" and "assign" |
47 | | - checks: argument,case,condition,return |
48 | | - lll: |
49 | | - line-length: 140 |
50 | | - misspell: |
51 | | - locale: US |
52 | | - prealloc: |
53 | | - # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. |
54 | | - # True by default. |
55 | | - simple: true |
56 | | - range-loops: true # Report preallocation suggestions on range loops, true by default |
57 | | - for-loops: false # Report preallocation suggestions on for loops, false by default |
58 | | - stylecheck: |
59 | | - dot-import-whitelist: |
60 | | - - github.com/onsi/ginkgo/v2 |
61 | | - - github.com/onsi/gomega |
62 | | - - github.com/onsi/gomega/gstruct |
63 | 6 |
|
64 | 7 | linters: |
65 | | - # please, do not use `enable-all`: it's deprecated and will be removed soon. |
66 | | - # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint |
67 | | - disable-all: true |
| 8 | + default: none |
68 | 9 | enable: |
| 10 | + - asciicheck # checks for non-ASCII identifiers |
| 11 | + - bidichk # checks for dangerous unicode sequences (security) |
69 | 12 | - bodyclose |
70 | 13 | - copyloopvar |
71 | 14 | - depguard |
72 | 15 | - dogsled |
73 | 16 | # TODO fix issues- dupl |
74 | 17 | # TODO fix issues- errcheck |
| 18 | + - errname # checks error naming conventions |
75 | 19 | - exhaustive |
76 | 20 | # TODO fix issues- funlen |
77 | | - #- gochecknoinits |
| 21 | + - gocheckcompilerdirectives # validates go compiler directives |
| 22 | + #- gochecknoinits |
78 | 23 | - goconst |
79 | 24 | # TODO fix issues- gocritic |
80 | 25 | # TODO fix issues- gocyclo |
81 | | - - gofmt |
82 | | - - goimports |
83 | | - # TODO fix issues- gomnd |
| 26 | + # gofmt and goimports are now formatters in v2, not linters |
| 27 | + # TODO fix issues- mnd (formerly gomnd) |
84 | 28 | - goprintffuncname |
85 | 29 | # TODO fix issues- gosec |
86 | | - - gosimple |
87 | | - #- govet |
| 30 | + # gosimple and stylecheck are now part of staticcheck in v2 |
| 31 | + - staticcheck |
| 32 | + #- govet |
88 | 33 | - ineffassign |
| 34 | + # TODO fix issues- intrange (2 issues - use integer ranges Go 1.22+) |
89 | 35 | # TODO fix issues- lll |
| 36 | + - makezero # finds slice declarations with non-zero initial length |
90 | 37 | - misspell |
91 | 38 | # TODO fix issues- nakedret |
| 39 | + # TODO fix issues- nilerr (3 issues - returns nil when error is not nil) |
| 40 | + # TODO fix issues- noctx (4 issues - missing context.Context) |
92 | 41 | # TODO fix issues- prealloc |
93 | | - #- scopelint |
94 | | - # TODO fix issues- staticcheck |
95 | | - - stylecheck |
96 | | - - typecheck |
| 42 | + - reassign # checks package variable reassignment |
| 43 | + #- scopelint |
97 | 44 | - unconvert |
98 | 45 | # TODO fix issues- unparam |
99 | 46 | - unused |
100 | 47 | - whitespace |
101 | 48 |
|
102 | | -issues: |
103 | | - exclude-dirs: |
104 | | - - vendor/ |
105 | | - - .github/ |
106 | | - - deployment/ |
107 | | - - doc/ |
108 | | - - bindata/ |
109 | | - - pkg/client |
110 | | - exclude-rules: |
111 | | - - path: _test\.go |
112 | | - linters: |
113 | | - - gomnd |
114 | | - - gosec |
115 | | - - dupl |
116 | | - - lll |
117 | | - - stylecheck |
118 | | - - goconst |
119 | | - - path: test/conformance/tests |
120 | | - linters: |
121 | | - - goconst |
| 49 | + settings: |
| 50 | + depguard: |
| 51 | + rules: |
| 52 | + main: |
| 53 | + deny: |
| 54 | + - pkg: github.com/sirupsen/logrus |
| 55 | + desc: "logging is allowed only by logutils.Log" |
| 56 | + dupl: |
| 57 | + threshold: 100 |
| 58 | + funlen: |
| 59 | + lines: 100 |
| 60 | + statements: 50 |
| 61 | + goconst: |
| 62 | + min-len: 2 |
| 63 | + min-occurrences: 2 |
| 64 | + gocritic: |
| 65 | + enabled-tags: |
| 66 | + - diagnostic |
| 67 | + - experimental |
| 68 | + - opinionated |
| 69 | + - performance |
| 70 | + - style |
| 71 | + disabled-checks: |
| 72 | + - ifElseChain # style preference - suggests switch over if-else |
| 73 | + - whyNoLint # requires explanation for nolint directives |
| 74 | + - unnamedResult # style preference - named return values |
| 75 | + settings: |
| 76 | + hugeParam: |
| 77 | + sizeThreshold: 512 |
| 78 | + rangeValCopy: |
| 79 | + sizeThreshold: 512 |
| 80 | + gocyclo: |
| 81 | + min-complexity: 15 |
| 82 | + mnd: |
| 83 | + # don't include the "operation" and "assign" |
| 84 | + checks: |
| 85 | + - argument |
| 86 | + - case |
| 87 | + - condition |
| 88 | + - return |
| 89 | + lll: |
| 90 | + line-length: 140 |
| 91 | + misspell: |
| 92 | + locale: US |
| 93 | + prealloc: |
| 94 | + # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. |
| 95 | + # True by default. |
| 96 | + simple: true |
| 97 | + range-loops: true # Report preallocation suggestions on range loops, true by default |
| 98 | + for-loops: false # Report preallocation suggestions on for loops, false by default |
| 99 | + staticcheck: |
| 100 | + checks: |
| 101 | + - all |
| 102 | + - -QF1001 # De Morgan's law suggestions |
| 103 | + - -QF1003 # tagged switch suggestions |
| 104 | + - -QF1008 # embedded field selector suggestions |
| 105 | + dot-import-whitelist: |
| 106 | + - github.com/onsi/ginkgo/v2 |
| 107 | + - github.com/onsi/gomega |
| 108 | + - github.com/onsi/gomega/gstruct |
122 | 109 |
|
| 110 | + exclusions: |
| 111 | + generated: lax |
| 112 | + presets: |
| 113 | + - comments |
| 114 | + - std-error-handling |
| 115 | + paths: |
| 116 | + - vendor/ |
| 117 | + - .github/ |
| 118 | + - deployment/ |
| 119 | + - doc/ |
| 120 | + - bindata/ |
| 121 | + - pkg/client |
| 122 | + rules: |
| 123 | + # Exclude various linters from test files |
| 124 | + - path: _test\.go |
| 125 | + linters: |
| 126 | + - mnd |
| 127 | + - gosec |
| 128 | + - dupl |
| 129 | + - lll |
| 130 | + - goconst |
| 131 | + # Exclude linters from test/ directory |
| 132 | + - path: ^test/ |
| 133 | + linters: |
| 134 | + - goconst |
| 135 | + |
| 136 | +formatters: |
| 137 | + enable: |
| 138 | + - gofmt |
| 139 | + - goimports |
| 140 | + settings: |
| 141 | + goimports: |
| 142 | + local-prefixes: |
| 143 | + - github.com/k8snetworkplumbingwg/sriov-network-operator |
0 commit comments