|
1 | | -# golangci-lint configuration. |
2 | | - |
3 | | -# For more information, see: |
4 | | -# https://golangci-lint.run/usage/configuration/. |
5 | | - |
6 | | -run: |
7 | | - timeout: 5m |
8 | | - |
9 | | -issues: |
10 | | - exclude-dirs: |
11 | | - # Contains a cloned subset of oasis-core. Some types are unused, some |
12 | | - # formatting is haphazard. We don't care much; this code is meant to be |
13 | | - # frozen in time. |
14 | | - - coreapi |
15 | | - |
16 | | - exclude-rules: |
17 | | - - path: '(.+)_test\.go' |
18 | | - linters: |
19 | | - - govet |
20 | | - - linters: [revive] |
21 | | - text: var-naming # do not demand that `Id` always be spelled `ID`; messes with autogenerated code |
22 | | - - linters: [structcheck] |
23 | | - text: is unused # linter has false positives; claims that fields are unused even though they're not |
24 | | - - linters: [revive] |
25 | | - text: stutters |
26 | | - - linters: [revive] |
27 | | - text: unused-parameter # it's fine to have unused func parameters that are not named `_`; they're usually there because the function is part of an interface |
28 | | - - linters: [stylecheck] |
29 | | - text: ST1003 # do not demand that `Id` always be spelled `ID`; messes with autogenerated code |
30 | | - |
| 1 | +version: "2" |
31 | 2 | linters: |
32 | | - # Disable all linters except the ones explicitly listed below. |
33 | | - disable-all: true |
| 3 | + default: none |
34 | 4 | enable: |
35 | | - - asciicheck |
36 | 5 | - bodyclose |
37 | | - - dogsled |
38 | | - - errcheck |
39 | | - - exhaustive |
| 6 | + - copyloopvar |
| 7 | + - depguard |
40 | 8 | - goconst |
41 | | - - gocritic |
42 | 9 | - gocyclo |
43 | | - - godot |
44 | | - - gofumpt |
45 | | - - goheader |
46 | | - - goimports |
47 | | - - gomodguard |
48 | 10 | - goprintffuncname |
49 | 11 | - gosec |
50 | | - - gosimple |
51 | 12 | - govet |
52 | 13 | - ineffassign |
53 | 14 | - misspell |
54 | | - - nakedret |
55 | | - - nestif |
56 | | - - noctx |
57 | | - - nolintlint |
58 | | - - prealloc |
59 | 15 | - revive |
60 | 16 | - rowserrcheck |
61 | 17 | - staticcheck |
62 | | - - stylecheck |
63 | | - - sqlclosecheck |
64 | | - - typecheck |
65 | 18 | - unconvert |
66 | | - - unparam |
67 | 19 | - unused |
68 | | - - whitespace |
69 | 20 |
|
70 | | -linters-settings: |
71 | | - exhaustive: |
72 | | - # Switch statements are to be considered exhaustive if a 'default' case is |
73 | | - # present, even if all enum members aren't listed in the switch. |
74 | | - default-signifies-exhaustive: true |
75 | | - govet: |
76 | | - # Enabled checking for shadowed variables. |
77 | | - shadow: true |
78 | | - gosec: |
79 | | - excludes: |
80 | | - # https://github.com/securego/gosec#available-rules |
81 | | - - G115 |
82 | | - goimports: |
83 | | - # Put local imports after 3rd-party packages. |
84 | | - local-prefixes: github.com/oasisprotocol/nexus |
| 21 | + settings: |
| 22 | + depguard: |
| 23 | + rules: |
| 24 | + main: |
| 25 | + files: |
| 26 | + - $all |
| 27 | + allow: |
| 28 | + - $gostd |
| 29 | + - github.com/oasisprotocol/nexus |
| 30 | + - github.com/oasisprotocol/oasis-core |
| 31 | + - github.com/oasisprotocol/oasis-sdk |
| 32 | + - github.com/oasisprotocol/metadata-registry-tools |
| 33 | + - github.com/akrylysov/pogreb |
| 34 | + - github.com/dgraph-io/ristretto |
| 35 | + - github.com/ethereum/go-ethereum |
| 36 | + - github.com/go-chi/chi/v5 |
| 37 | + - github.com/go-kit/log |
| 38 | + - github.com/golang-migrate/migrate/v4 |
| 39 | + - github.com/google/uuid |
| 40 | + - github.com/jackc/pgx/v5 |
| 41 | + - github.com/knadh/koanf |
| 42 | + - github.com/prometheus/client_golang/prometheus |
| 43 | + - github.com/rs/cors |
| 44 | + - github.com/spf13/cobra |
| 45 | + - github.com/stretchr/testify/assert |
| 46 | + - github.com/stretchr/testify/require |
| 47 | + - golang.org/x/crypto/sha3 |
| 48 | + - google.golang.org/grpc |
| 49 | + - golang.org/x/sync/errgroup |
| 50 | + deny: |
| 51 | + - pkg: github.com/pkg/errors |
| 52 | + desc: Should be replaced by standard lib errors package |
| 53 | + - pkg: github.com/fxamacker/cbor/v2 |
| 54 | + desc: Use oasis-core/go/common/cbor instead |
| 55 | + |
| 56 | + exclusions: |
| 57 | + generated: lax |
| 58 | + rules: |
| 59 | + # Exclude some linters on test files. |
| 60 | + - linters: |
| 61 | + - govet |
| 62 | + - revive |
| 63 | + - gosec |
| 64 | + path: (.+)_test\.go |
| 65 | + - linters: |
| 66 | + - govet |
| 67 | + - revive |
| 68 | + - gosec |
| 69 | + path: tests/* |
| 70 | + # Exclude var-naming. |
| 71 | + - linters: |
| 72 | + - revive |
| 73 | + text: var-naming |
| 74 | + # Exclude sttutering. |
| 75 | + - linters: |
| 76 | + - revive |
| 77 | + text: and that stutters |
| 78 | + # Exclude unused parameters. |
| 79 | + - linters: |
| 80 | + - revive |
| 81 | + text: unused-parameter |
| 82 | + # Exclude required comments on exported structs/fields. |
| 83 | + - linters: |
| 84 | + - revive |
| 85 | + text: "exported:" |
| 86 | + # Exclude could apply De Morgan's law. |
| 87 | + - linters: |
| 88 | + - staticcheck |
| 89 | + text: QF1001 |
| 90 | + # Exclude could remove embedded fields. |
| 91 | + - linters: |
| 92 | + - staticcheck |
| 93 | + text: QF1008 |
| 94 | + # Exclude intiger overflow conversion. |
| 95 | + - linters: |
| 96 | + - gosec |
| 97 | + text: G115 |
| 98 | + # Exclude audited unsafe calls. |
| 99 | + - linters: |
| 100 | + - gosec |
| 101 | + text: G103 |
| 102 | + |
| 103 | + paths: |
| 104 | + - coreapi |
| 105 | + - third_party$ |
| 106 | + - builtin$ |
| 107 | + - examples$ |
| 108 | + - cmd/bisect |
| 109 | + |
| 110 | +formatters: |
| 111 | + enable: |
| 112 | + - gofumpt |
| 113 | + - goimports |
| 114 | + |
| 115 | + settings: |
| 116 | + goimports: |
| 117 | + local-prefixes: |
| 118 | + - github.com/oasisprotocol/nexus |
| 119 | + |
| 120 | + exclusions: |
| 121 | + generated: lax |
| 122 | + paths: |
| 123 | + - coreapi |
| 124 | + - third_party$ |
| 125 | + - builtin$ |
| 126 | + - examples$ |
0 commit comments