|
| 1 | +linters-settings: |
| 2 | + depguard: |
| 3 | + list-type: blacklist |
| 4 | + include-go-root: false |
| 5 | + packages-with-error-message: |
| 6 | + - errors: "Use github.com/pkg/errors instead of errors" |
| 7 | + dogsled: |
| 8 | + # checks assignments with too many blank identifiers; default is 2 |
| 9 | + max-blank-identifiers: 2 |
| 10 | + dupl: |
| 11 | + # tokens count to trigger issue, 150 by default |
| 12 | + threshold: 100 |
| 13 | + errcheck: |
| 14 | + # report about not checking of errors in type assertions: `a := b.(MyStruct)`; |
| 15 | + # default is false: such cases aren't reported by default. |
| 16 | + check-type-assertions: false |
| 17 | + |
| 18 | + # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; |
| 19 | + # default is false: such cases aren't reported by default. |
| 20 | + check-blank: false |
| 21 | + |
| 22 | + # [deprecated] comma-separated list of pairs of the form pkg:regex |
| 23 | + # the regex is used to ignore names within pkg. (default "fmt:.*"). |
| 24 | + # see https://github.com/kisielk/errcheck#the-deprecated-method for details |
| 25 | + ignore: fmt:.* |
| 26 | + |
| 27 | + exhaustive: |
| 28 | + # indicates that switch statements are to be considered exhaustive if a |
| 29 | + # 'default' case is present, even if all enum members aren't listed in the |
| 30 | + # switch |
| 31 | + default-signifies-exhaustive: true |
| 32 | + funlen: |
| 33 | + lines: 100 |
| 34 | + statements: 50 |
| 35 | + gci: |
| 36 | + # put imports beginning with prefix after 3rd-party packages; |
| 37 | + # only support one prefix |
| 38 | + # if not set, use goimports.local-prefixes |
| 39 | + local-prefixes: github.com/Eun/go-test-buckets |
| 40 | + gocognit: |
| 41 | + # minimal code complexity to report, 30 by default (but we recommend 10-20) |
| 42 | + min-complexity: 30 |
| 43 | + nestif: |
| 44 | + # minimal complexity of if statements to report, 5 by default |
| 45 | + min-complexity: 5 |
| 46 | + goconst: |
| 47 | + # minimal length of string constant, 3 by default |
| 48 | + min-len: 3 |
| 49 | + # minimal occurrences count to trigger, 3 by default |
| 50 | + min-occurrences: 3 |
| 51 | + gocritic: |
| 52 | + enabled-tags: |
| 53 | + - diagnostic |
| 54 | + - experimental |
| 55 | + - opinionated |
| 56 | + - performance |
| 57 | + - style |
| 58 | + disabled-checks: |
| 59 | + - dupImport # https://github.com/go-critic/go-critic/issues/845 |
| 60 | + - ifElseChain |
| 61 | + - octalLiteral |
| 62 | + - whyNoLint |
| 63 | + - wrapperFunc |
| 64 | + gocyclo: |
| 65 | + # minimal code complexity to report, 30 by default (but we recommend 10-20) |
| 66 | + min-complexity: 30 |
| 67 | + godot: |
| 68 | + # check all top-level comments, not only declarations |
| 69 | + check-all: false |
| 70 | + gofmt: |
| 71 | + # simplify code: gofmt with `-s` option, true by default |
| 72 | + simplify: true |
| 73 | + goimports: |
| 74 | + # put imports beginning with prefix after 3rd-party packages; |
| 75 | + # it's a comma-separated list of prefixes |
| 76 | + local-prefixes: github.com/Eun/go-test-buckets |
| 77 | + golint: |
| 78 | + # minimal confidence for issues, default is 0.8 |
| 79 | + min-confidence: 0.8 |
| 80 | + gomnd: |
| 81 | + settings: |
| 82 | + mnd: |
| 83 | + # the list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description. |
| 84 | + checks: argument,case,condition,operation,return,assign |
| 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/golangci/golangci-lint/pkg/logutils.Log).Infof |
| 94 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf |
| 95 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf |
| 96 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf |
| 97 | + lll: |
| 98 | + # max line length, lines longer will be reported. Default is 120. |
| 99 | + # '\t' is counted as 1 character by default, and can be changed with the tab-width option |
| 100 | + line-length: 140 |
| 101 | + # tab width in spaces. Default to 1. |
| 102 | + tab-width: 1 |
| 103 | + misspell: |
| 104 | + # Correct spellings using locale preferences for US or UK. |
| 105 | + # Default is to use a neutral variety of English. |
| 106 | + # Setting locale to US will correct the British spelling of 'colour' to 'color'. |
| 107 | + locale: US |
| 108 | + nakedret: |
| 109 | + # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 |
| 110 | + max-func-lines: 30 |
| 111 | + prealloc: |
| 112 | + simple: true |
| 113 | + range-loops: true # Report preallocation suggestions on range loops, true by default |
| 114 | + for-loops: false # Report preallocation suggestions on for loops, false by default |
| 115 | + nolintlint: |
| 116 | + # Enable to ensure that nolint directives are all used. Default is true. |
| 117 | + allow-unused: false |
| 118 | + # Disable to ensure that nolint directives don't have a leading space. Default is true. |
| 119 | + allow-leading-space: true |
| 120 | + # Exclude following linters from requiring an explanation. Default is []. |
| 121 | + allow-no-explanation: [] |
| 122 | + # Enable to require an explanation of nonzero length after each nolint directive. Default is false. |
| 123 | + require-explanation: true |
| 124 | + # Enable to require nolint directives to mention the specific linter being suppressed. Default is false. |
| 125 | + require-specific: true |
| 126 | + unparam: |
| 127 | + # Inspect exported functions, default is false. Set to true if no external program/library imports your code. |
| 128 | + # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: |
| 129 | + # if it's called for subdir of a project it can't find external interfaces. All text editor integrations |
| 130 | + # with golangci-lint call it on a directory with the changed file. |
| 131 | + check-exported: false |
| 132 | + unused: |
| 133 | + # treat code as a program (not a library) and report unused exported identifiers; default is false. |
| 134 | + # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: |
| 135 | + # if it's called for subdir of a project it can't find funcs usages. All text editor integrations |
| 136 | + # with golangci-lint call it on a directory with the changed file. |
| 137 | + check-exported: false |
| 138 | + |
| 139 | +linters: |
| 140 | + disable-all: true |
| 141 | + enable: |
| 142 | + - bodyclose |
| 143 | + - deadcode |
| 144 | + - depguard |
| 145 | + - dogsled |
| 146 | + - dupl |
| 147 | + - errcheck |
| 148 | + - exhaustive |
| 149 | + - funlen |
| 150 | + - gochecknoinits |
| 151 | + - gocognit |
| 152 | + - goconst |
| 153 | + - gocritic |
| 154 | + - gocyclo |
| 155 | + - godot |
| 156 | + - gofmt |
| 157 | + - goimports |
| 158 | + - golint |
| 159 | + - gomnd |
| 160 | + - goprintffuncname |
| 161 | + - gosec |
| 162 | + - gosimple |
| 163 | + - govet |
| 164 | + - ineffassign |
| 165 | + - lll |
| 166 | + - misspell |
| 167 | + - nestif |
| 168 | + - nakedret |
| 169 | + - noctx |
| 170 | + - nolintlint |
| 171 | + - prealloc |
| 172 | + - rowserrcheck |
| 173 | + - scopelint |
| 174 | + - staticcheck |
| 175 | + - structcheck |
| 176 | + - stylecheck |
| 177 | + - typecheck |
| 178 | + - unconvert |
| 179 | + - unparam |
| 180 | + - unused |
| 181 | + - varcheck |
| 182 | + - whitespace |
| 183 | + |
| 184 | + |
| 185 | +issues: |
| 186 | + # Independently from option `exclude` we use default exclude patterns, |
| 187 | + # it can be disabled by this option. To list all |
| 188 | + # excluded by default patterns execute `golangci-lint run --help`. |
| 189 | + # Default value for this option is true. |
| 190 | + exclude-use-default: false |
| 191 | + # Maximum issues count per one linter. Set to 0 to disable. Default is 50. |
| 192 | + max-issues-per-linter: 0 |
| 193 | + # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. |
| 194 | + max-same-issues: 0 |
| 195 | + |
| 196 | + exclude-rules: |
| 197 | + # Exclude some linters from running on tests files. |
| 198 | + - path: _test\.go |
| 199 | + linters: |
| 200 | + - gocyclo |
| 201 | + - errcheck |
| 202 | + - dupl |
| 203 | + - gosec |
| 204 | + - funlen |
| 205 | + - goconst |
| 206 | + - scopelint |
| 207 | + - gocognit |
| 208 | + - lll |
| 209 | + - text: 'shadow: declaration of "err" shadows declaration at line \d+' |
| 210 | + linters: |
| 211 | + - govet |
| 212 | + - text: "don't use an underscore in package name" |
| 213 | + linters: |
| 214 | + - golint |
| 215 | + - text: "should not use underscores in package names" |
| 216 | + linters: |
| 217 | + - stylecheck |
| 218 | + |
| 219 | + |
| 220 | +# golangci.com configuration |
| 221 | +# https://github.com/golangci/golangci/wiki/Configuration |
| 222 | +service: |
| 223 | + golangci-lint-version: 1.23.x # use the fixed version to not introduce new linters unexpectedly |
| 224 | + prepare: |
| 225 | + - echo "here I can run custom commands, but no preparation needed for this repo" |
0 commit comments