|
1 | | -# This file contains all available configuration options |
2 | | -# with their default values. |
3 | | - |
4 | | -# options for analysis running |
5 | | -run: |
6 | | - # default concurrency is a available CPU number |
7 | | - concurrency: 4 |
8 | | - |
9 | | - # timeout for analysis, e.g. 30s, 5m, default is 1m |
10 | | - timeout: 5m |
11 | 1 | linters-settings: |
12 | | - goimports: |
13 | | - # put imports beginning with prefix after 3rd-party packages; |
14 | | - # it's a comma-separated list of prefixes |
15 | | - local-prefixes: github.com/freiheit-com/nmww |
| 2 | + errcheck: |
| 3 | + # report about not checking of errors in type assetions: `a := b.(MyStruct)`; |
| 4 | + # default is false: such cases aren't reported by default. |
| 5 | + check-type-assertions: true |
| 6 | + |
| 7 | + # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; |
| 8 | + # default is false: such cases aren't reported by default. |
| 9 | + check-blank: true |
| 10 | + exhaustive: |
| 11 | + # Presence of "default" case in switch statements satisfies exhaustiveness, |
| 12 | + # even if all enum members are not listed. |
| 13 | + default-signifies-exhaustive: true |
| 14 | + funlen: |
| 15 | + lines: 100 |
| 16 | + statements: 50 |
| 17 | + gci: |
| 18 | + custom-order: true |
| 19 | + sections: |
| 20 | + - standard |
| 21 | + - default |
| 22 | + - prefix(dev.azure.com/schwarzit) |
| 23 | + gofmt: |
| 24 | + # simplify code: gofmt with `-s` option, true by default |
| 25 | + simplify: true |
| 26 | + gocyclo: |
| 27 | + min-complexity: 30 |
| 28 | + gocognit: |
| 29 | + min-complexity: 30 |
| 30 | + dupl: |
| 31 | + threshold: 150 |
| 32 | + goconst: |
| 33 | + min-len: 3 |
| 34 | + min-occurrences: 2 |
| 35 | + govet: |
| 36 | + enable-all: true |
| 37 | + disable: |
| 38 | + - fieldalignment |
16 | 39 | depguard: |
17 | 40 | rules: |
18 | | - main: |
19 | | - list-mode: lax # Everything is allowed unless it is denied |
| 41 | + all: |
20 | 42 | deny: |
21 | | - - pkg: "github.com/stretchr/testify" |
22 | | - desc: Do not use a testing framework |
| 43 | + - pkg: github.com/sirupsen/logrus |
| 44 | + desc: logging is done using the internal/log package |
| 45 | + - pkg: log |
| 46 | + desc: logging is done using the internal/log package |
23 | 47 | misspell: |
24 | | - # Correct spellings using locale preferences for US or UK. |
25 | | - # Default is to use a neutral variety of English. |
26 | | - # Setting locale to US will correct the British spelling of 'colour' to 'color'. |
27 | | - locale: US |
28 | | - golint: |
29 | | - min-confidence: 0.8 |
30 | | - gosec: |
31 | | - excludes: |
32 | | - # Suppressions: (see https://github.com/securego/gosec#available-rules for details) |
33 | | - - G104 # "Audit errors not checked" -> which we don't need and is a badly implemented version of errcheck |
34 | | - - G102 # "Bind to all interfaces" -> since this is normal in k8s |
35 | | - - G304 # "File path provided as taint input" -> too many false positives |
36 | | - - G307 # "Deferring unsafe method "Close" on type "io.ReadCloser" -> false positive when calling defer resp.Body.Close() |
| 48 | + #locale: US |
| 49 | + lll: |
| 50 | + line-length: 140 |
| 51 | + tab-width: 1 |
| 52 | + cyclop: |
| 53 | + # the maximal code complexity to report |
| 54 | + max-complexity: 20 |
| 55 | + # the maximal average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0) |
| 56 | + package-average: 0.0 |
| 57 | + unused: |
| 58 | + # treat code as a program (not a library) and report unused exported identifiers; default is false. |
| 59 | + # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: |
| 60 | + # if it's called for subdir of a project it can't find funcs usages. All text editor integrations |
| 61 | + # with golangci-lint call it on a directory with the changed file. |
| 62 | + check-exported: false |
| 63 | + unparam: |
| 64 | + # Inspect exported functions, default is false. Set to true if no external program/library imports your code. |
| 65 | + # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: |
| 66 | + # if it's called for subdir of a project it can't find external interfaces. All text editor integrations |
| 67 | + # with golangci-lint call it on a directory with the changed file. |
| 68 | + check-exported: false |
37 | 69 | nakedret: |
38 | | - max-func-lines: 0 |
| 70 | + # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 |
| 71 | + max-func-lines: 5 |
| 72 | + prealloc: |
| 73 | + # XXX: we don't recommend using this linter before doing performance profiling. |
| 74 | + # For most programs usage of prealloc will be a premature optimization. |
| 75 | + |
| 76 | + # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. |
| 77 | + # True by default. |
| 78 | + simple: true |
| 79 | + range-loops: true # Report preallocation suggestions on range loops, true by default |
| 80 | + for-loops: true # Report preallocation suggestions on for loops, false by default |
| 81 | + gocritic: |
| 82 | + enabled-tags: |
| 83 | + - diagnostic |
| 84 | + - experimental |
| 85 | + - opinionated |
| 86 | + - performance |
| 87 | + - style |
| 88 | + disabled-checks: |
| 89 | + - dupImport # https://github.com/go-critic/go-critic/issues/845 |
| 90 | + - octalLiteral |
| 91 | + - unnamedResult |
| 92 | + # Settings passed to gocritic. |
| 93 | + # The settings key is the name of a supported gocritic checker. |
| 94 | + # The list of supported checkers can be find in https://go-critic.github.io/overview. |
| 95 | + settings: |
| 96 | + hugeParam: |
| 97 | + # Size in bytes that makes the warning trigger. |
| 98 | + # Default: 80 |
| 99 | + sizeThreshold: 101 # Adjusted this to 101 to fit the schwarz principles https://principles.schwarz/engineering-principles/go/515_consider_using_value_types_over_pointers/ |
| 100 | + dogsled: |
| 101 | + # checks assignments with too many blank identifiers; default is 2 |
| 102 | + max-blank-identifiers: 2 |
| 103 | + whitespace: |
| 104 | + multi-if: false # Enforces newlines (or comments) after every multi-line if statement |
| 105 | + multi-func: false # Enforces newlines (or comments) after every multi-line function signature |
| 106 | + gomoddirectives: |
| 107 | + # List of allowed `replace` directives. Default is empty. |
| 108 | + # Add your allowed `replace` targets here, this rule is so you don't accidentally commit replacements you added for testing |
| 109 | + replace-allow-list: [] |
| 110 | + mnd: |
| 111 | + # don't include the "operation" and "assign" |
| 112 | + checks: |
| 113 | + - argument |
| 114 | + - case |
| 115 | + - condition |
| 116 | + - return |
| 117 | + - operation |
| 118 | + - assign |
| 119 | + nolintlint: |
| 120 | + allow-leading-space: false # require machine-readable nolint directives (i.e. with no leading space) |
| 121 | + allow-unused: false # report any unused nolint directives |
| 122 | + require-explanation: true # require an explanation for nolint directives |
| 123 | + require-specific: true # require nolint directives to be specific about which linter is being skipped |
| 124 | + nlreturn: |
| 125 | + # Size of the block (including return statement that is still "OK") |
| 126 | + # so no return split required. |
| 127 | + block-size: 5 |
| 128 | + stylecheck: |
| 129 | + initialisms: ["ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS"] |
39 | 130 | revive: |
40 | | - ignore-generated-header: true |
41 | | - severity: error |
42 | | - # https://github.com/mgechev/revive |
43 | 131 | rules: |
| 132 | + - name: context-keys-type |
| 133 | + disabled: false |
| 134 | + - name: time-naming |
| 135 | + disabled: false |
| 136 | + - name: var-declaration |
| 137 | + disabled: false |
| 138 | + - name: unexported-return |
| 139 | + disabled: false |
44 | 140 | - name: errorf |
| 141 | + disabled: false |
| 142 | + - name: blank-imports |
| 143 | + disabled: false |
45 | 144 | - name: context-as-argument |
| 145 | + disabled: false |
| 146 | + - name: dot-imports |
| 147 | + disabled: false |
46 | 148 | - name: error-return |
| 149 | + disabled: false |
| 150 | + - name: error-strings |
| 151 | + disabled: false |
| 152 | + - name: error-naming |
| 153 | + disabled: false |
| 154 | + - name: exported |
| 155 | + disabled: false |
47 | 156 | - name: increment-decrement |
| 157 | + disabled: false |
| 158 | + - name: var-naming |
| 159 | + disabled: false |
| 160 | + - name: package-comments |
| 161 | + disabled: false |
| 162 | + - name: range |
| 163 | + disabled: false |
| 164 | + - name: receiver-naming |
| 165 | + disabled: false |
48 | 166 | - name: indent-error-flow |
49 | | - - name: superfluous-else |
50 | | - - name: unused-parameter |
51 | | - - name: unreachable-code |
52 | | - - name: atomic |
53 | | - - name: empty-lines |
54 | | - - name: early-return |
55 | | - gocritic: |
56 | | - enabled-tags: |
57 | | - - performance |
58 | | - - style |
59 | | - - experimental |
60 | | - disabled-checks: |
61 | | - - wrapperFunc |
62 | | - - typeDefFirst |
63 | | - - ifElseChain |
64 | | - - dupImport # https://github.com/go-critic/go-critic/issues/845 |
| 167 | + disabled: false |
| 168 | + |
65 | 169 | linters: |
| 170 | + # please, do not use `enable-all`: it's deprecated and will be removed soon. |
| 171 | + # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint |
| 172 | + disable-all: true |
66 | 173 | enable: |
67 | | - # https://golangci-lint.run/usage/linters/ |
68 | | - # default linters |
69 | | - - gosimple |
70 | | - - govet |
71 | | - - ineffassign |
72 | | - - staticcheck |
73 | | - - typecheck |
74 | | - - unused |
75 | | - # additional linters |
76 | | - - errorlint |
| 174 | + - depguard |
| 175 | + - dogsled |
| 176 | + - dupl |
| 177 | + - copyloopvar |
| 178 | + - exhaustive |
| 179 | + - funlen |
77 | 180 | - gochecknoinits |
| 181 | + - goconst |
78 | 182 | - gocritic |
| 183 | + - gocyclo |
| 184 | + - godot |
79 | 185 | - gofmt |
80 | | - - goimports |
| 186 | + - mnd |
| 187 | + - goprintffuncname |
81 | 188 | - gosec |
| 189 | + - govet |
| 190 | + - ineffassign |
| 191 | + - lll |
| 192 | + - gosimple |
82 | 193 | - misspell |
83 | 194 | - nakedret |
| 195 | + - nolintlint |
84 | 196 | - revive |
85 | | - - depguard |
| 197 | + - staticcheck |
| 198 | + - stylecheck |
| 199 | + - typecheck |
| 200 | + - unconvert |
| 201 | + - unused |
| 202 | + - whitespace |
| 203 | + - gochecknoglobals |
| 204 | + - err113 |
| 205 | + - prealloc |
| 206 | + - asciicheck |
| 207 | + - nestif |
86 | 208 | - bodyclose |
| 209 | + - cyclop |
| 210 | + - durationcheck |
| 211 | + - errcheck |
| 212 | + - errorlint |
| 213 | + - forbidigo |
| 214 | + - forcetypeassert |
| 215 | + - gci |
| 216 | + - gocognit |
| 217 | + - gofumpt |
| 218 | + - gomoddirectives |
| 219 | + - gomodguard |
| 220 | + - importas |
| 221 | + - makezero |
| 222 | + - nilerr |
| 223 | + - nlreturn |
| 224 | + - noctx |
| 225 | + - predeclared |
| 226 | + - promlinter |
| 227 | + - rowserrcheck |
87 | 228 | - sqlclosecheck |
| 229 | + - tparallel |
| 230 | + - unparam |
88 | 231 | - wastedassign |
89 | | - - forcetypeassert |
90 | | - - errcheck |
91 | | - disable: |
92 | | - - noctx # false positive: finds errors with http.NewRequest that dont make sense |
93 | | - - unparam # false positives |
| 232 | + - wsl |
| 233 | + |
| 234 | + # don't enable: |
| 235 | + # - tagliatelle # have a different naming schema |
| 236 | + # - golint # deprecated |
| 237 | + # - scopelint # deprecated |
| 238 | + # - interfacer # deprecated |
| 239 | + # - testpackage # this is not best practice in go |
| 240 | + # - godox # we want to use keywords like TODO or FIX in the code |
| 241 | + # - goimports # we already have gci |
| 242 | + |
| 243 | + |
94 | 244 | issues: |
95 | | - exclude-use-default: false |
| 245 | + # Excluding configuration per-path, per-linter, per-text and per-source |
| 246 | + exclude-rules: |
| 247 | + - path: _test\.go |
| 248 | + linters: |
| 249 | + - gochecknoglobals |
| 250 | + - noctx |
| 251 | + - funlen |
| 252 | + - err113 |
| 253 | + - mnd |
| 254 | + - forcetypeassert |
| 255 | + - dogsled |
| 256 | + - goconst |
| 257 | + - unparam |
| 258 | + - dupl |
| 259 | + - errcheck |
| 260 | + - forbidigo |
| 261 | + - lll |
| 262 | + - gocritic |
| 263 | + - nestif |
| 264 | + - revive |
| 265 | + - gocognit |
| 266 | + - unconvert |
| 267 | + - unparam |
| 268 | + - wsl |
| 269 | + - gosimple |
| 270 | + - ineffassign |
| 271 | + - nakedret |
| 272 | + - nlreturn |
| 273 | + - staticcheck |
| 274 | + - stylecheck |
| 275 | + - wastedassign |
| 276 | + - gofumpt |
| 277 | + - text: 'declaration of "err" shadows declaration' |
| 278 | + linters: |
| 279 | + - govet |
| 280 | + - path: test_.*\.go |
| 281 | + linters: |
| 282 | + - gochecknoglobals |
| 283 | + - noctx |
| 284 | + - funlen |
| 285 | + - err113 |
| 286 | + - mnd |
| 287 | + - forcetypeassert |
| 288 | + - dogsled |
| 289 | + - goconst |
| 290 | + - unparam |
| 291 | + - dupl |
| 292 | + - errcheck |
| 293 | + - forbidigo |
| 294 | + - lll |
| 295 | + - gocritic |
| 296 | + - nestif |
| 297 | + - revive |
| 298 | + - gocognit |
| 299 | + - unconvert |
| 300 | + - unparam |
| 301 | + - wsl |
| 302 | + - gosimple |
| 303 | + - ineffassign |
| 304 | + - nakedret |
| 305 | + - nlreturn |
| 306 | + - staticcheck |
| 307 | + - stylecheck |
| 308 | + - wastedassign |
| 309 | + - gofumpt |
| 310 | + max-same-issues: 0 |
| 311 | + max-issues-per-linter: 0 |
| 312 | +run: |
| 313 | + timeout: 10m |
| 314 | + issues-exit-code: 1 |
| 315 | + tests: true |
| 316 | + build-tags: |
| 317 | + - integration |
0 commit comments