|
1 | | -# golangci-lint configuration. |
2 | | - |
3 | | -# For more information, see: |
4 | | -# https://golangci-lint.run/usage/configuration/. |
5 | | - |
6 | | -run: |
7 | | - timeout: 5m |
8 | | - |
| 1 | +version: "2" |
9 | 2 | linters: |
10 | | - # Disable all linters except the ones explicitly listed below. |
11 | | - disable-all: true |
| 3 | + default: none |
12 | 4 | enable: |
13 | | - - asciicheck |
14 | 5 | - bodyclose |
| 6 | + - copyloopvar |
15 | 7 | - depguard |
16 | | - - dogsled |
17 | | - - dupl |
18 | 8 | - errcheck |
19 | | - - exhaustive |
20 | 9 | - goconst |
21 | | - - gocritic |
22 | 10 | - gocyclo |
23 | | - - godot |
24 | | - - gofumpt |
25 | | - - goheader |
26 | | - - goimports |
27 | | - - revive |
28 | | - - gomodguard |
29 | 11 | - goprintffuncname |
30 | 12 | - gosec |
31 | | - - gosimple |
32 | 13 | - govet |
33 | 14 | - ineffassign |
34 | 15 | - misspell |
35 | | - - nakedret |
36 | | - - nestif |
37 | | - - noctx |
38 | | - - prealloc |
| 16 | + - revive |
39 | 17 | - rowserrcheck |
40 | 18 | - staticcheck |
41 | | - - stylecheck |
42 | | - - sqlclosecheck |
43 | | - - typecheck |
44 | 19 | - unconvert |
45 | | - - unparam |
46 | 20 | - unused |
47 | | - - whitespace |
48 | 21 |
|
49 | | -linters-settings: |
50 | | - exhaustive: |
51 | | - # Switch statements are to be considered exhaustive if a 'default' case is |
52 | | - # present, even if all enum members aren't listed in the switch. |
53 | | - default-signifies-exhaustive: true |
54 | | - goimports: |
55 | | - # Put local imports after 3rd-party packages. |
56 | | - local-prefixes: github.com/oasisprotocol/ |
57 | | - gosec: |
58 | | - excludes: |
59 | | - # https://github.com/securego/gosec#available-rules |
60 | | - - G402 |
61 | | - - G404 |
62 | | - - G115 |
63 | | - depguard: |
| 22 | + settings: |
| 23 | + depguard: |
| 24 | + rules: |
| 25 | + main: |
| 26 | + files: |
| 27 | + - $all |
| 28 | + allow: |
| 29 | + - $gostd |
| 30 | + - github.com/oasisprotocol/oasis-web3-gateway |
| 31 | + - github.com/oasisprotocol/oasis-core |
| 32 | + - github.com/oasisprotocol/oasis-sdk |
| 33 | + - github.com/ethereum/go-ethereum |
| 34 | + - github.com/gorilla/mux |
| 35 | + - github.com/gorilla/websocket |
| 36 | + - github.com/knadh/koanf |
| 37 | + - github.com/prometheus/client_golang/prometheus |
| 38 | + - github.com/rs/cors |
| 39 | + - github.com/spf13/cobra |
| 40 | + - github.com/stretchr/testify |
| 41 | + - github.com/uptrace/bun |
| 42 | + - golang.org/x/crypto |
| 43 | + - google.golang.org/grpc |
| 44 | + deny: |
| 45 | + - pkg: "github.com/pkg/errors" |
| 46 | + desc: Should be replaced by standard lib errors package |
| 47 | + - pkg: github.com/fxamacker/cbor/v2 |
| 48 | + desc: Use oasis-core/go/common/cbor instead |
| 49 | + |
| 50 | + exclusions: |
| 51 | + generated: lax |
64 | 52 | rules: |
65 | | - main: |
66 | | - files: |
67 | | - - $all |
68 | | - allow: |
69 | | - - $gostd |
70 | | - - github.com/oasisprotocol |
71 | | - - google.golang.org/grpc |
72 | | - - github.com/ethereum/go-ethereum |
73 | | - - github.com/stretchr/testify |
74 | | - - github.com/uptrace/bun |
75 | | - - github.com/gorilla |
76 | | - - github.com/prometheus |
77 | | - - github.com/knadh/koanf |
78 | | - - github.com/rs/cors |
79 | | - - github.com/spf13/cobra |
| 53 | + # Exclude some linters on test files. |
| 54 | + - linters: |
| 55 | + - govet |
| 56 | + - revive |
| 57 | + - gosec |
| 58 | + - errcheck |
| 59 | + path: (.+)_test\.go |
| 60 | + - linters: |
| 61 | + - govet |
| 62 | + - revive |
| 63 | + - gosec |
| 64 | + path: tests/* |
| 65 | + # Exclude var-naming. |
| 66 | + - linters: |
| 67 | + - revive |
| 68 | + text: var-naming |
| 69 | + # Exclude sttutering. |
| 70 | + - linters: |
| 71 | + - revive |
| 72 | + text: and that stutters |
| 73 | + # Exclude unused parameters. |
| 74 | + - linters: |
| 75 | + - revive |
| 76 | + text: unused-parameter |
| 77 | + # Exclude required comments on exported structs/fields. |
| 78 | + - linters: |
| 79 | + - revive |
| 80 | + text: "exported:" |
| 81 | + # Exclude could apply De Morgan's law. |
| 82 | + - linters: |
| 83 | + - staticcheck |
| 84 | + text: QF1001 |
| 85 | + # Exclude could remove embedded fields. |
| 86 | + - linters: |
| 87 | + - staticcheck |
| 88 | + text: QF1008 |
| 89 | + # Exclude intiger overflow conversion. |
| 90 | + - linters: |
| 91 | + - gosec |
| 92 | + text: G115 |
| 93 | + # Exclude audited unsafe calls. |
| 94 | + - linters: |
| 95 | + - gosec |
| 96 | + text: G103 |
| 97 | + |
| 98 | +formatters: |
| 99 | + enable: |
| 100 | + - gofumpt |
| 101 | + - goimports |
| 102 | + settings: |
| 103 | + goimports: |
| 104 | + local-prefixes: |
| 105 | + - github.com/oasisprotocol/ |
0 commit comments