|
| 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: 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 | + - "\\.\\w+\\.go$" |
| 37 | + |
| 38 | + # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules": |
| 39 | + # If invoked with -mod=readonly, the go command is disallowed from the implicit |
| 40 | + # automatic updating of go.mod described above. Instead, it fails when any changes |
| 41 | + # to go.mod are needed. This setting is most useful to check that go.mod does |
| 42 | + # not need updates, such as in a continuous integration and testing system. |
| 43 | + # If invoked with -mod=vendor, the go command assumes that the vendor |
| 44 | + # directory holds the correct copies of dependencies and ignores |
| 45 | + # the dependency descriptions in go.mod. |
| 46 | + modules-download-mode: readonly |
| 47 | + |
| 48 | + |
| 49 | +# output configuration options |
| 50 | +output: |
| 51 | + # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" |
| 52 | + # format: colored-line-number |
| 53 | + |
| 54 | + # print lines of code with issue, default is true |
| 55 | + # print-issued-lines: true |
| 56 | + |
| 57 | + # print linter name in the end of issue text, default is true |
| 58 | + # print-linter-name: true |
| 59 | + |
| 60 | + |
| 61 | +# all available settings of specific linters |
| 62 | +linters-settings: |
| 63 | + errcheck: |
| 64 | + # report about not checking of errors in type assetions: `a := b.(MyStruct)`; |
| 65 | + # default is false: such cases aren't reported by default. |
| 66 | + # check-type-assertions: false |
| 67 | + |
| 68 | + # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; |
| 69 | + # default is false: such cases aren't reported by default. |
| 70 | + # check-blank: false |
| 71 | + |
| 72 | + # [deprecated] comma-separated list of pairs of the form pkg:regex |
| 73 | + # the regex is used to ignore names within pkg. (default "fmt:.*"). |
| 74 | + # see https://github.com/kisielk/errcheck#the-deprecated-method for details |
| 75 | + # ignore: fmt:.*,io/ioutil:^Read.* |
| 76 | + |
| 77 | + # path to a file containing a list of functions to exclude from checking |
| 78 | + # see https://github.com/kisielk/errcheck#excluding-functions for details |
| 79 | + # exclude: .errcheck.excludes |
| 80 | + |
| 81 | + funlen: |
| 82 | + lines: 60 |
| 83 | + statements: 40 |
| 84 | + |
| 85 | + govet: |
| 86 | + # report about shadowed variables |
| 87 | + check-shadowing: true |
| 88 | + |
| 89 | + # settings per analyzer |
| 90 | + settings: |
| 91 | + printf: # analyzer name, run `go tool vet help` to see all analyzers |
| 92 | + funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer |
| 93 | + # - (github.com/powerman/structlog.Logger).Fatalf |
| 94 | + # - (github.com/powerman/structlog.Logger).Panicf |
| 95 | + # - (github.com/powerman/structlog.Logger).Printf |
| 96 | + |
| 97 | + # enable or disable analyzers by name |
| 98 | + # enable: |
| 99 | + # - atomicalign |
| 100 | + enable-all: true |
| 101 | + # disable: |
| 102 | + # - shadow |
| 103 | + # disable-all: false |
| 104 | + golint: |
| 105 | + # minimal confidence for issues, default is 0.8 |
| 106 | + # min-confidence: 0.8 |
| 107 | + gofmt: |
| 108 | + # simplify code: gofmt with `-s` option, true by default |
| 109 | + # simplify: true |
| 110 | + goimports: |
| 111 | + # put imports beginning with prefix after 3rd-party packages; |
| 112 | + # it's a comma-separated list of prefixes |
| 113 | + # local-prefixes: github.com/mtgroupit |
| 114 | + gocyclo: |
| 115 | + # minimal code complexity to report, 30 by default (but we recommend 10-20) |
| 116 | + min-complexity: 15 |
| 117 | + gocognit: |
| 118 | + # minimal code complexity to report, 30 by default (but we recommend 10-20) |
| 119 | + min-complexity: 20 |
| 120 | + maligned: |
| 121 | + # print struct with more effective memory layout or not, false by default |
| 122 | + suggest-new: true |
| 123 | + dupl: |
| 124 | + # tokens count to trigger issue, 150 by default |
| 125 | + threshold: 100 |
| 126 | + goconst: |
| 127 | + # minimal length of string constant, 3 by default |
| 128 | + # min-len: 3 |
| 129 | + # minimal occurrences count to trigger, 3 by default |
| 130 | + # min-occurrences: 3 |
| 131 | + depguard: |
| 132 | + list-type: blacklist |
| 133 | + include-go-root: true |
| 134 | + packages: |
| 135 | + - log |
| 136 | + packages-with-error-messages: |
| 137 | + # specify an error message to output when a blacklisted package is used |
| 138 | + log: "logging is allowed only by github.com/powerman/structlog" |
| 139 | + misspell: |
| 140 | + # Correct spellings using locale preferences for US or UK. |
| 141 | + # Default is to use a neutral variety of English. |
| 142 | + # Setting locale to US will correct the British spelling of 'colour' to 'color'. |
| 143 | + # locale: US |
| 144 | + # ignore-words: |
| 145 | + # - someword |
| 146 | + lll: |
| 147 | + # max line length, lines longer will be reported. Default is 120. |
| 148 | + # '\t' is counted as 1 character by default, and can be changed with the tab-width option |
| 149 | + # line-length: 120 |
| 150 | + # tab width in spaces. Default to 1. |
| 151 | + # tab-width: 1 |
| 152 | + unused: |
| 153 | + # treat code as a program (not a library) and report unused exported identifiers; default is false. |
| 154 | + # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: |
| 155 | + # if it's called for subdir of a project it can't find funcs usages. All text editor integrations |
| 156 | + # with golangci-lint call it on a directory with the changed file. |
| 157 | + # check-exported: false |
| 158 | + unparam: |
| 159 | + # Inspect exported functions, default is false. Set to true if no external program/library imports your code. |
| 160 | + # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: |
| 161 | + # if it's called for subdir of a project it can't find external interfaces. All text editor integrations |
| 162 | + # with golangci-lint call it on a directory with the changed file. |
| 163 | + # check-exported: false |
| 164 | + nakedret: |
| 165 | + # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 |
| 166 | + # max-func-lines: 30 |
| 167 | + prealloc: |
| 168 | + # XXX: we don't recommend using this linter before doing performance profiling. |
| 169 | + # For most programs usage of prealloc will be a premature optimization. |
| 170 | + |
| 171 | + # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. |
| 172 | + # True by default. |
| 173 | + # simple: true |
| 174 | + # range-loops: true # Report preallocation suggestions on range loops, true by default |
| 175 | + # for-loops: false # Report preallocation suggestions on for loops, false by default |
| 176 | + gocritic: |
| 177 | + # Which checks should be enabled; can't be combined with 'disabled-checks'; |
| 178 | + # See https://go-critic.github.io/overview#checks-overview |
| 179 | + # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run` |
| 180 | + # By default list of stable checks is used. |
| 181 | + # enabled-checks: |
| 182 | + # - rangeValCopy |
| 183 | + |
| 184 | + # Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty |
| 185 | + disabled-checks: |
| 186 | + - hugeParam # premature optimization |
| 187 | + - paramTypeCombine # questionable |
| 188 | + - yodaStyleExpr # questionable |
| 189 | + |
| 190 | + # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks. |
| 191 | + # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". |
| 192 | + enabled-tags: |
| 193 | + - diagnostic |
| 194 | + - style |
| 195 | + - performance |
| 196 | + - experimental |
| 197 | + - opinionated |
| 198 | + |
| 199 | + settings: # settings passed to gocritic |
| 200 | + captLocal: # must be valid enabled check name |
| 201 | + paramsOnly: true |
| 202 | + rangeValCopy: |
| 203 | + sizeThreshold: 32 |
| 204 | + godox: |
| 205 | + # report any comments starting with keywords, this is useful for TODO or FIXME comments that |
| 206 | + # might be left in the code accidentally and should be resolved before merging |
| 207 | + keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting |
| 208 | + - BUG # marks issues that should be moved to issue tracker before merging |
| 209 | + - FIXME # marks issues that should be resolved before merging |
| 210 | + dogsled: |
| 211 | + # checks assignments with too many blank identifiers; default is 2 |
| 212 | + max-blank-identifiers: 2 |
| 213 | + |
| 214 | + whitespace: |
| 215 | + multi-if: false # Enforces newlines (or comments) after every multi-line if statement |
| 216 | + multi-func: false # Enforces newlines (or comments) after every multi-line function signature |
| 217 | + wsl: |
| 218 | + # If true append is only allowed to be cuddled if appending value is |
| 219 | + # matching variables, fields or types on line above. Default is true. |
| 220 | + strict-append: true |
| 221 | + # Allow calls and assignments to be cuddled as long as the lines have any |
| 222 | + # matching variables, fields or types. Default is true. |
| 223 | + allow-assign-and-call: true |
| 224 | + # Allow multiline assignments to be cuddled. Default is true. |
| 225 | + allow-multiline-assign: true |
| 226 | + |
| 227 | +linters: |
| 228 | + # enable: |
| 229 | + # - megacheck |
| 230 | + # - govet |
| 231 | + enable-all: true |
| 232 | + disable: |
| 233 | + - dogsled # questionable |
| 234 | + - dupl |
| 235 | + # - gochecknoglobals |
| 236 | + # - gochecknoinits |
| 237 | + - lll |
| 238 | + # - misspell |
| 239 | + - prealloc |
| 240 | + - wsl # questionable |
| 241 | + # disable-all: false |
| 242 | + # presets: |
| 243 | + # - bugs |
| 244 | + # - unused |
| 245 | + fast: false |
| 246 | + |
| 247 | + |
| 248 | +issues: |
| 249 | + # List of regexps of issue texts to exclude, empty list by default. |
| 250 | + # But independently from this option we use default exclude patterns, |
| 251 | + # it can be disabled by `exclude-use-default: false`. To list all |
| 252 | + # excluded by default patterns execute `golangci-lint run --help` |
| 253 | + exclude: |
| 254 | + - "declaration of \"(log|err|ctx)\" shadows" |
| 255 | + - "Potential file inclusion via variable" # [DEFAULT] gosec: False positive is triggered by 'src, err := ioutil.ReadFile(filename)' |
| 256 | + |
| 257 | + # Excluding configuration per-path, per-linter, per-text and per-source |
| 258 | + exclude-rules: |
| 259 | + # Exclude some linters from running on tests files. |
| 260 | + - path: _test\.go|testing\.go |
| 261 | + linters: |
| 262 | + - bodyclose |
| 263 | + - dupl |
| 264 | + - errcheck |
| 265 | + - funlen |
| 266 | + - gochecknoglobals |
| 267 | + - gochecknoinits |
| 268 | + - gocyclo |
| 269 | + - gosec |
| 270 | + - maligned |
| 271 | + |
| 272 | + # Ease some gocritic warnings on test files. |
| 273 | + - path: _test\.go|testing\.go |
| 274 | + text: "(unnamedResult|exitAfterDefer|rangeValCopy)" |
| 275 | + linters: |
| 276 | + - gocritic |
| 277 | + |
| 278 | + # Package def is designed to contain global constants. |
| 279 | + - path: internal/def/ |
| 280 | + linters: |
| 281 | + - gochecknoglobals |
| 282 | + |
| 283 | + # Commands are allowed to contain a lot of flags. |
| 284 | + - path: cmd/.*/main.go |
| 285 | + text: Function '(init|main)' |
| 286 | + linters: |
| 287 | + - funlen |
| 288 | + |
| 289 | + # Swagger API setup is allowed to contain a lot of methods. |
| 290 | + - path: internal/(extapi|api)/api.go |
| 291 | + text: Function 'NewServer' |
| 292 | + linters: |
| 293 | + - funlen |
| 294 | + - path: restapi/configure.*.go |
| 295 | + text: Function 'configureAPI' |
| 296 | + linters: |
| 297 | + - funlen |
| 298 | + |
| 299 | + # Exclude known linters from partially hard-vendored code, |
| 300 | + # which is impossible to exclude via "nolint" comments. |
| 301 | + # - path: internal/hmac/ |
| 302 | + # text: "weak cryptographic primitive" |
| 303 | + # linters: |
| 304 | + # - gosec |
| 305 | + |
| 306 | + # Exclude some staticcheck messages |
| 307 | + # - linters: |
| 308 | + # - staticcheck |
| 309 | + # text: "SA9003:" |
| 310 | + |
| 311 | + # Exclude lll issues for long lines with go:generate |
| 312 | + # - linters: |
| 313 | + # - lll |
| 314 | + # source: "^//go:generate " |
| 315 | + |
| 316 | + # Independently from option `exclude` we use default exclude patterns, |
| 317 | + # it can be disabled by this option. To list all |
| 318 | + # excluded by default patterns execute `golangci-lint run --help`. |
| 319 | + # Default value for this option is true. |
| 320 | + exclude-use-default: false |
| 321 | + |
| 322 | + # Maximum issues count per one linter. Set to 0 to disable. Default is 50. |
| 323 | + max-issues-per-linter: 0 |
| 324 | + |
| 325 | + # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. |
| 326 | + max-same-issues: 0 |
| 327 | + |
| 328 | + # Show only new issues: if there are unstaged changes or untracked files, |
| 329 | + # only those changes are analyzed, else only changes in HEAD~ are analyzed. |
| 330 | + # It's a super-useful option for integration of golangci-lint into existing |
| 331 | + # large codebase. It's not practical to fix all existing issues at the moment |
| 332 | + # of integration: much better don't allow issues in new code. |
| 333 | + # Default is false. |
| 334 | + # new: false |
| 335 | + |
| 336 | + # Show only new issues created after git revision `REV` |
| 337 | + # new-from-rev: REV |
| 338 | + |
| 339 | + # Show only new issues created in git patch with set file path. |
| 340 | + # new-from-patch: path/to/patch/file |
0 commit comments