github.com/nalekseevs/itns-golangci-lint@v1.0.2/.golangci.yml (about) 1 # This configuration file is not a recommendation. 2 # 3 # We intentionally use a limited set of linters. 4 # This configuration file is used with different version of golangci-lint to avoid regressions: 5 # the linters can change between version, 6 # their configuration may be not compatible or their reports can be different, 7 # and this can break some of our tests. 8 # Also, some linters are not relevant for the project (e.g. linters related to SQL). 9 # 10 # We have specific constraints, so we use a specific configuration. 11 # 12 # See the file `.golangci.reference.yml` to have a list of all available configuration options. 13 14 linters-settings: 15 depguard: 16 rules: 17 logger: 18 deny: 19 # logging is allowed only by logutils.Log, 20 - pkg: "github.com/sirupsen/logrus" 21 desc: logging is allowed only by logutils.Log. 22 - pkg: "github.com/pkg/errors" 23 desc: Should be replaced by standard lib errors package. 24 - pkg: "github.com/instana/testify" 25 desc: It's a fork of github.com/stretchr/testify. 26 files: 27 # logrus is allowed to use only in logutils package. 28 - "!**/pkg/logutils/**.go" 29 dupl: 30 threshold: 100 31 funlen: 32 lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. 33 statements: 50 34 goconst: 35 min-len: 2 36 min-occurrences: 3 37 gocritic: 38 enabled-tags: 39 - diagnostic 40 - experimental 41 - opinionated 42 - performance 43 - style 44 disabled-checks: 45 - dupImport # https://github.com/go-critic/go-critic/issues/845 46 - ifElseChain 47 - octalLiteral 48 - whyNoLint 49 gocyclo: 50 min-complexity: 15 51 godox: 52 keywords: 53 - FIXME 54 gofmt: 55 rewrite-rules: 56 - pattern: 'interface{}' 57 replacement: 'any' 58 goimports: 59 local-prefixes: github.com/nalekseevs/itns-golangci-lint 60 mnd: 61 # don't include the "operation" and "assign" 62 checks: 63 - argument 64 - case 65 - condition 66 - return 67 ignored-numbers: 68 - '0' 69 - '1' 70 - '2' 71 - '3' 72 ignored-functions: 73 - strings.SplitN 74 govet: 75 settings: 76 printf: 77 funcs: 78 - (github.com/nalekseevs/itns-golangci-lint/pkg/logutils.Log).Infof 79 - (github.com/nalekseevs/itns-golangci-lint/pkg/logutils.Log).Warnf 80 - (github.com/nalekseevs/itns-golangci-lint/pkg/logutils.Log).Errorf 81 - (github.com/nalekseevs/itns-golangci-lint/pkg/logutils.Log).Fatalf 82 enable: 83 - nilness 84 - shadow 85 errorlint: 86 asserts: false 87 lll: 88 line-length: 140 89 misspell: 90 locale: US 91 ignore-words: 92 - "importas" # linter name 93 nolintlint: 94 allow-unused: false # report any unused nolint directives 95 require-explanation: true # require an explanation for nolint directives 96 require-specific: true # require nolint directives to be specific about which linter is being skipped 97 revive: 98 rules: 99 - name: indent-error-flow 100 - name: unexported-return 101 disabled: true 102 - name: unused-parameter 103 - name: unused-receiver 104 105 linters: 106 disable-all: true 107 enable: 108 - bodyclose 109 - depguard 110 - dogsled 111 - dupl 112 - errcheck 113 - errorlint 114 - exportloopref 115 - funlen 116 - gocheckcompilerdirectives 117 - gochecknoinits 118 - goconst 119 - gocritic 120 - gocyclo 121 - godox 122 - gofmt 123 - goimports 124 - mnd 125 - goprintffuncname 126 - gosec 127 - gosimple 128 - govet 129 - ineffassign 130 - lll 131 - misspell 132 - nakedret 133 - noctx 134 - nolintlint 135 - revive 136 - staticcheck 137 - stylecheck 138 - testifylint 139 - unconvert 140 - unparam 141 - unused 142 - whitespace 143 144 # This list of linters is not a recommendation (same thing for all this configuration file). 145 # We intentionally use a limited set of linters. 146 # See the comment on top of this file. 147 148 issues: 149 exclude-rules: 150 - path: (.+)_test\.go 151 linters: 152 - dupl 153 - mnd 154 - lll 155 156 # The logic of creating a linter is similar between linters, it's not duplication. 157 - path: pkg/golinters 158 linters: 159 - dupl 160 161 # Deprecated configuration options. 162 - path: pkg/commands/run.go 163 linters: [staticcheck] 164 text: "SA1019: c.cfg.Run.ShowStats is deprecated: use Output.ShowStats instead." 165 166 # Deprecated linter options. 167 - path: pkg/golinters/errcheck/errcheck.go 168 linters: [staticcheck] 169 text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" 170 - path: pkg/golinters/govet/govet.go 171 linters: [staticcheck] 172 text: "SA1019: cfg.CheckShadowing is deprecated: the linter should be enabled inside Enable." 173 - path: pkg/golinters/godot/godot.go 174 linters: [staticcheck] 175 text: "SA1019: settings.CheckAll is deprecated: use Scope instead" 176 - path: pkg/golinters/gci/gci.go 177 linters: [staticcheck] 178 text: "SA1019: settings.LocalPrefixes is deprecated: use Sections instead." 179 - path: pkg/golinters/mnd/mnd.go 180 linters: [staticcheck] 181 text: "SA1019: settings.Settings is deprecated: use root level settings instead." 182 - path: pkg/golinters/mnd/mnd.go 183 linters: [staticcheck] 184 text: "SA1019: config.GoMndSettings is deprecated: use MndSettings." 185 186 # Related to `run.go`, it cannot be removed. 187 - path: pkg/golinters/gofumpt/gofumpt.go 188 linters: [staticcheck] 189 text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." 190 - path: pkg/golinters/internal/staticcheck_common.go 191 linters: [staticcheck] 192 text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." 193 - path: pkg/lint/lintersdb/manager.go 194 linters: [staticcheck] 195 text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." 196 197 # Based on existing code, the modifications should be limited to make maintenance easier. 198 - path: pkg/golinters/unused/unused.go 199 linters: [gocritic] 200 text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" 201 202 exclude-dirs: 203 - test/testdata_etc # test files 204 - internal/cache # extracted from Go code 205 - internal/renameio # extracted from Go code 206 - internal/robustio # extracted from Go code 207 208 run: 209 timeout: 5m