|
| 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 | + # deadline: 1m |
| 11 | + |
| 12 | + # exit code when at least one issue was found, default is 1 |
| 13 | + # issues-exit-code: 1 |
| 14 | + |
| 15 | + # include test files or not, default is true |
| 16 | + # tests: true |
| 17 | + |
| 18 | + # list of build tags, all linters use it. Default is empty list. |
| 19 | + build-tags: |
| 20 | + - integration |
| 21 | + |
| 22 | + # which dirs to skip: they won't be analyzed; |
| 23 | + # can use regexp here: generated.*, regexp is applied on full path; |
| 24 | + # default value is empty list, but next dirs are always skipped independently |
| 25 | + # from this option's value: |
| 26 | + # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ |
| 27 | + # skip-dirs: |
| 28 | + # - src/external_libs |
| 29 | + # - autogenerated_by_my_lib |
| 30 | + |
| 31 | + # which files to skip: they will be analyzed, but issues from them |
| 32 | + # won't be reported. Default value is empty list, but there is |
| 33 | + # no need to include all autogenerated files, we confidently recognize |
| 34 | + # autogenerated files. If it's not please let us know. |
| 35 | + # skip-files: |
| 36 | + # - "\\.html\\.go$" |
| 37 | + # - "\\.json\\.go$" |
| 38 | + # - "\\.sql\\.go$" |
| 39 | + # - "_reform\\.go$" |
| 40 | + |
| 41 | + # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules": |
| 42 | + # If invoked with -mod=readonly, the go command is disallowed from the implicit |
| 43 | + # automatic updating of go.mod described above. Instead, it fails when any changes |
| 44 | + # to go.mod are needed. This setting is most useful to check that go.mod does |
| 45 | + # not need updates, such as in a continuous integration and testing system. |
| 46 | + # If invoked with -mod=vendor, the go command assumes that the vendor |
| 47 | + # directory holds the correct copies of dependencies and ignores |
| 48 | + # the dependency descriptions in go.mod. |
| 49 | + modules-download-mode: readonly |
| 50 | + |
| 51 | + |
| 52 | +# output configuration options |
| 53 | +output: |
| 54 | + # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" |
| 55 | + # format: colored-line-number |
| 56 | + |
| 57 | + # print lines of code with issue, default is true |
| 58 | + # print-issued-lines: true |
| 59 | + |
| 60 | + # print linter name in the end of issue text, default is true |
| 61 | + # print-linter-name: true |
| 62 | + |
| 63 | + |
| 64 | +# all available settings of specific linters |
1 | 65 | linters-settings:
|
2 |
| - errcheck: |
3 |
| - check-type-assertions: false |
4 |
| - check-blank: false |
5 |
| - govet: |
6 |
| - check-shadowing: true |
7 |
| - golint: |
8 |
| - min-confidence: 0 # 0.8 |
9 |
| - gocyclo: |
10 |
| - min-complexity: 25 # 30 |
11 |
| - maligned: |
12 |
| - suggest-new: false |
13 |
| - dupl: |
14 |
| - threshold: 150 |
15 |
| - goconst: |
16 |
| - min-len: 3 |
17 |
| - min-occurrences: 3 |
18 |
| - unused: |
19 |
| - check-exported: false |
20 |
| - unparam: |
21 |
| - algo: cha |
22 |
| - check-exported: false |
23 |
| - nakedret: |
24 |
| - max-func-lines: 30 |
25 |
| - prealloc: |
26 |
| - simple: true |
27 |
| - range-loops: true |
28 |
| - for-loops: false |
29 |
| - gocritic: |
30 |
| - enabled-checks: |
31 |
| - - appendAssign |
32 |
| - - appendCombine |
33 |
| - - assignOp |
34 |
| - - boolExprSimplify |
35 |
| - - caseOrder |
36 |
| - - defaultCaseOrder |
37 |
| - - deprecatedComment |
38 |
| - - dupArg |
39 |
| - - dupBranchBody |
40 |
| - - dupCase |
41 |
| - - flagDeref |
42 |
| - - ifElseChain |
43 |
| - - indexAlloc |
44 |
| - - methodExprCall |
45 |
| - - rangeExprCopy |
46 |
| - # - rangeValCopy |
47 |
| - - regexpMust |
48 |
| - - singleCaseSwitch |
49 |
| - - sloppyLen |
50 |
| - # - switchTrue |
51 |
| - - typeSwitchVar |
52 |
| - - underef |
53 |
| - # - unlabelStmt |
54 |
| - - unlambda |
55 |
| - - unslice |
| 66 | + errcheck: |
| 67 | + # report about not checking of errors in type assetions: `a := b.(MyStruct)`; |
| 68 | + # default is false: such cases aren't reported by default. |
| 69 | + # check-type-assertions: false |
| 70 | + |
| 71 | + # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; |
| 72 | + # default is false: such cases aren't reported by default. |
| 73 | + # check-blank: false |
| 74 | + |
| 75 | + # [deprecated] comma-separated list of pairs of the form pkg:regex |
| 76 | + # the regex is used to ignore names within pkg. (default "fmt:.*"). |
| 77 | + # see https://github.com/kisielk/errcheck#the-deprecated-method for details |
| 78 | + # ignore: fmt:.*,io/ioutil:^Read.* |
| 79 | + |
| 80 | + # path to a file containing a list of functions to exclude from checking |
| 81 | + # see https://github.com/kisielk/errcheck#excluding-functions for details |
| 82 | + # exclude: .errcheck.excludes |
| 83 | + govet: |
| 84 | + # report about shadowed variables |
| 85 | + check-shadowing: true |
| 86 | + golint: |
| 87 | + # minimal confidence for issues, default is 0.8 |
| 88 | + # min-confidence: 0.8 |
| 89 | + gofmt: |
| 90 | + # simplify code: gofmt with `-s` option, true by default |
| 91 | + # simplify: true |
| 92 | + goimports: |
| 93 | + # put imports beginning with prefix after 3rd-party packages; |
| 94 | + # it's a comma-separated list of prefixes |
| 95 | + # local-prefixes: github.com/mtgroupit |
| 96 | + gocyclo: |
| 97 | + # minimal code complexity to report, 30 by default (but we recommend 10-20) |
| 98 | + min-complexity: 25 |
| 99 | + maligned: |
| 100 | + # print struct with more effective memory layout or not, false by default |
| 101 | + suggest-new: true |
| 102 | + dupl: |
| 103 | + # tokens count to trigger issue, 150 by default |
| 104 | + threshold: 100 |
| 105 | + goconst: |
| 106 | + # minimal length of string constant, 3 by default |
| 107 | + # min-len: 3 |
| 108 | + # minimal occurrences count to trigger, 3 by default |
| 109 | + # min-occurrences: 3 |
| 110 | + depguard: |
| 111 | + list-type: blacklist |
| 112 | + include-go-root: true |
| 113 | + # packages: |
| 114 | + # - log |
| 115 | + misspell: |
| 116 | + # Correct spellings using locale preferences for US or UK. |
| 117 | + # Default is to use a neutral variety of English. |
| 118 | + # Setting locale to US will correct the British spelling of 'colour' to 'color'. |
| 119 | + locale: US |
| 120 | + # ignore-words: |
| 121 | + # - someword |
| 122 | + lll: |
| 123 | + # max line length, lines longer will be reported. Default is 120. |
| 124 | + # '\t' is counted as 1 character by default, and can be changed with the tab-width option |
| 125 | + # line-length: 120 |
| 126 | + # tab width in spaces. Default to 1. |
| 127 | + # tab-width: 1 |
| 128 | + unused: |
| 129 | + # treat code as a program (not a library) and report unused exported identifiers; default is false. |
| 130 | + # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: |
| 131 | + # if it's called for subdir of a project it can't find funcs usages. All text editor integrations |
| 132 | + # with golangci-lint call it on a directory with the changed file. |
| 133 | + # check-exported: false |
| 134 | + unparam: |
| 135 | + # Inspect exported functions, default is false. Set to true if no external program/library imports your code. |
| 136 | + # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: |
| 137 | + # if it's called for subdir of a project it can't find external interfaces. All text editor integrations |
| 138 | + # with golangci-lint call it on a directory with the changed file. |
| 139 | + # check-exported: false |
| 140 | + nakedret: |
| 141 | + # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 |
| 142 | + # max-func-lines: 30 |
| 143 | + prealloc: |
| 144 | + # XXX: we don't recommend using this linter before doing performance profiling. |
| 145 | + # For most programs usage of prealloc will be a premature optimization. |
| 146 | + |
| 147 | + # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. |
| 148 | + # True by default. |
| 149 | + # simple: true |
| 150 | + # range-loops: true # Report preallocation suggestions on range loops, true by default |
| 151 | + # for-loops: false # Report preallocation suggestions on for loops, false by default |
| 152 | + gocritic: |
| 153 | + # Which checks should be enabled; can't be combined with 'disabled-checks'; |
| 154 | + # See https://go-critic.github.io/overview#checks-overview |
| 155 | + # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run` |
| 156 | + # By default list of stable checks is used. |
| 157 | + # enabled-checks: |
| 158 | + # - rangeValCopy |
| 159 | + |
| 160 | + # Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty |
| 161 | + disabled-checks: |
| 162 | + - hugeParam # premature optimization |
| 163 | + - paramTypeCombine # questionable |
| 164 | + |
| 165 | + # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks. |
| 166 | + # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". |
| 167 | + enabled-tags: |
| 168 | + - diagnostic |
| 169 | + - style |
| 170 | + - performance |
| 171 | + - experimental |
| 172 | + - opinionated |
| 173 | + |
| 174 | + settings: # settings passed to gocritic |
| 175 | + captLocal: # must be valid enabled check name |
| 176 | + paramsOnly: true |
| 177 | + rangeValCopy: |
| 178 | + sizeThreshold: 32 |
56 | 179 |
|
57 | 180 | linters:
|
58 |
| - enable-all: true |
59 |
| - disable: |
60 |
| - - gofmt |
61 |
| - - goimports |
62 |
| - - depguard |
| 181 | + # enable: |
| 182 | + # - megacheck |
| 183 | + # - govet |
| 184 | + enable-all: true |
| 185 | + disable: |
| 186 | + # - dupl |
| 187 | + # - gochecknoglobals |
| 188 | + # - gochecknoinits |
| 189 | + - lll |
| 190 | + # - misspell |
| 191 | + - prealloc |
| 192 | + # disable-all: false |
| 193 | + # presets: |
| 194 | + # - bugs |
| 195 | + # - unused |
| 196 | + fast: false |
| 197 | + |
| 198 | + |
| 199 | +issues: |
| 200 | + # List of regexps of issue texts to exclude, empty list by default. |
| 201 | + # But independently from this option we use default exclude patterns, |
| 202 | + # it can be disabled by `exclude-use-default: false`. To list all |
| 203 | + # excluded by default patterns execute `golangci-lint run --help` |
| 204 | + exclude: |
| 205 | + - "declaration of \"(log|err|ctx)\" shadows" |
| 206 | + - "Potential file inclusion via variable" # [DEFAULT] gosec: False positive is triggered by 'src, err := ioutil.ReadFile(filename)' |
| 207 | + |
| 208 | + # Excluding configuration per-path and per-linter |
| 209 | + exclude-rules: |
| 210 | + # Exclude some linters from running on tests files. |
| 211 | + - path: _test\.go |
| 212 | + linters: |
| 213 | + - gocyclo |
| 214 | + - errcheck |
63 | 215 | - dupl
|
64 |
| - - gochecknoglobals |
| 216 | + - gosec |
65 | 217 | - gochecknoinits
|
66 |
| - - lll |
67 |
| - - scopelint |
| 218 | + - gochecknoglobals |
68 | 219 |
|
69 |
| -issues: |
70 |
| - exclude-use-default: true |
71 |
| - exclude: |
72 |
| - - "declaration of \"err\" shadows" |
| 220 | + # Ease some gocritic warnings on test files. |
| 221 | + - path: _test\.go |
| 222 | + text: "(unnamedResult|exitAfterDefer)" |
| 223 | + linters: |
| 224 | + - gocritic |
| 225 | + |
| 226 | + # Package def is designed to contain global constants. |
| 227 | + - path: internal/def/ |
| 228 | + linters: |
| 229 | + - gochecknoglobals |
| 230 | + |
| 231 | + # Exclude known linters from partially hard-vendored code, |
| 232 | + # which is impossible to exclude via "nolint" comments. |
| 233 | + # - path: internal/hmac/ |
| 234 | + # text: "weak cryptographic primitive" |
| 235 | + # linters: |
| 236 | + # - gosec |
| 237 | + # - path: internal/hmac/ |
| 238 | + # text: "Write\\` is not checked" |
| 239 | + # linters: |
| 240 | + # - errcheck |
| 241 | + |
| 242 | + # Ease linting on benchmarking code. |
| 243 | + # - path: cmd/stun-bench/ |
| 244 | + # linters: |
| 245 | + # - gosec |
| 246 | + # - errcheck |
| 247 | + |
| 248 | + # Independently from option `exclude` we use default exclude patterns, |
| 249 | + # it can be disabled by this option. To list all |
| 250 | + # excluded by default patterns execute `golangci-lint run --help`. |
| 251 | + # Default value for this option is true. |
| 252 | + exclude-use-default: false |
| 253 | + |
| 254 | + # Maximum issues count per one linter. Set to 0 to disable. Default is 50. |
| 255 | + max-per-linter: 0 |
| 256 | + |
| 257 | + # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. |
| 258 | + max-same-issues: 0 |
| 259 | + |
| 260 | + # Show only new issues: if there are unstaged changes or untracked files, |
| 261 | + # only those changes are analyzed, else only changes in HEAD~ are analyzed. |
| 262 | + # It's a super-useful option for integration of golangci-lint into existing |
| 263 | + # large codebase. It's not practical to fix all existing issues at the moment |
| 264 | + # of integration: much better don't allow issues in new code. |
| 265 | + # Default is false. |
| 266 | + # new: false |
| 267 | + |
| 268 | + # Show only new issues created after git revision `REV` |
| 269 | + # new-from-rev: REV |
| 270 | + |
| 271 | + # Show only new issues created in git patch with set file path. |
| 272 | + # new-from-patch: path/to/patch/file |
0 commit comments