|
1 | 1 | --- |
| 2 | +version: "2" |
| 3 | + |
| 4 | +formatters: |
| 5 | + enable: |
| 6 | + - gci |
| 7 | + - gofumpt |
| 8 | + settings: |
| 9 | + gci: |
| 10 | + sections: |
| 11 | + - standard |
| 12 | + - prefix(github.com/prometheus-community/elasticsearch_exporter) |
| 13 | + - default |
| 14 | + |
2 | 15 | linters: |
3 | 16 | enable: |
| 17 | + - depguard |
| 18 | + # TODO(@sysadmind): Enable and fix the issues. |
| 19 | + # - errorlint |
| 20 | + - exptostd |
| 21 | + # TODO(@sysadmind): Enable and fix the issues. |
| 22 | + # - gocritic |
| 23 | + # - godot |
| 24 | + - loggercheck |
| 25 | + # TODO(@sysadmind): Enable and fix the issues. |
| 26 | + # - misspell |
| 27 | + - nilnesserr |
| 28 | + - nolintlint |
| 29 | + # TODO(@sysadmind): Enable and fix the issues. |
| 30 | + # - perfsprint |
| 31 | + - predeclared |
4 | 32 | - revive |
5 | 33 | - sloglint |
| 34 | + - testifylint |
| 35 | + - unconvert |
| 36 | + - unused |
| 37 | + - usestdlibvars |
| 38 | + - whitespace |
| 39 | + exclusions: |
| 40 | + rules: |
| 41 | + # Disable errcheck for test files. |
| 42 | + - linters: |
| 43 | + - errcheck |
| 44 | + path: _test.go |
6 | 45 |
|
7 | | -issues: |
8 | | - exclude-rules: |
9 | | - - path: _test.go |
10 | | - linters: |
11 | | - - errcheck |
| 46 | + # Disable errcheck rule for some specific functions. |
| 47 | + - linters: |
| 48 | + - errcheck |
| 49 | + # Taken from the default exclusions in v1. |
| 50 | + text: Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked |
12 | 51 |
|
13 | | -linters-settings: |
14 | | - revive: |
15 | | - rules: |
16 | | - # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter |
17 | | - - name: unused-parameter |
18 | | - severity: warning |
19 | | - disabled: true |
| 52 | + settings: |
| 53 | + revive: |
| 54 | + rules: |
| 55 | + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md |
| 56 | + - name: blank-imports |
| 57 | + - name: comment-spacings |
| 58 | + - name: context-as-argument |
| 59 | + arguments: |
| 60 | + # Allow functions with test or bench signatures. |
| 61 | + - allowTypesBefore: '*testing.T,testing.TB' |
| 62 | + - name: context-keys-type |
| 63 | + - name: dot-imports |
| 64 | + - name: early-return |
| 65 | + arguments: |
| 66 | + - "preserveScope" |
| 67 | + # A lot of false positives: incorrectly identifies channel draining as "empty code block". |
| 68 | + # See https://github.com/mgechev/revive/issues/386 |
| 69 | + - name: empty-block |
| 70 | + disabled: true |
| 71 | + - name: error-naming |
| 72 | + - name: error-return |
| 73 | + - name: error-strings |
| 74 | + - name: errorf |
| 75 | + # TODO(@sysadmind): Enable and fix the issues. |
| 76 | + # - name: exported |
| 77 | + - name: increment-decrement |
| 78 | + - name: indent-error-flow |
| 79 | + arguments: |
| 80 | + - "preserveScope" |
| 81 | + - name: package-comments |
| 82 | + # TODO(beorn7/sysadmind): Currently, we have a lot of missing package doc comments. Maybe we should have them. |
| 83 | + disabled: true |
| 84 | + - name: range |
| 85 | + - name: receiver-naming |
| 86 | + - name: redefines-builtin-id |
| 87 | + - name: superfluous-else |
| 88 | + arguments: |
| 89 | + - "preserveScope" |
| 90 | + - name: time-naming |
| 91 | + # TODO(@sysadmind): Enable and fix the issues. |
| 92 | + # - name: unexported-return |
| 93 | + - name: unreachable-code |
| 94 | + - name: unused-parameter |
| 95 | + severity: warning |
| 96 | + disabled: true |
| 97 | + - name: var-declaration |
| 98 | + - name: var-naming |
| 99 | + |
| 100 | + depguard: |
| 101 | + rules: |
| 102 | + main: |
| 103 | + deny: |
| 104 | + - pkg: "sync/atomic" |
| 105 | + desc: "Use go.uber.org/atomic instead of sync/atomic" |
| 106 | + - pkg: "github.com/stretchr/testify/assert" |
| 107 | + desc: "Use github.com/stretchr/testify/require instead of github.com/stretchr/testify/assert" |
| 108 | + - pkg: "github.com/go-kit/kit/log" |
| 109 | + desc: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log" |
| 110 | + - pkg: "io/ioutil" |
| 111 | + desc: "Use corresponding 'os' or 'io' functions instead." |
| 112 | + - pkg: "regexp" |
| 113 | + desc: "Use github.com/grafana/regexp instead of regexp" |
| 114 | + - pkg: "github.com/pkg/errors" |
| 115 | + desc: "Use 'errors' or 'fmt' instead of github.com/pkg/errors" |
| 116 | + - pkg: "gzip" |
| 117 | + desc: "Use github.com/klauspost/compress instead of gzip" |
| 118 | + - pkg: "zlib" |
| 119 | + desc: "Use github.com/klauspost/compress instead of zlib" |
| 120 | + - pkg: "golang.org/x/exp/slices" |
| 121 | + desc: "Use 'slices' instead." |
| 122 | +issues: |
| 123 | + max-issues-per-linter: 0 |
| 124 | + max-same-issues: 0 |
0 commit comments