|
1 | | -run: |
2 | | - timeout: 10m |
3 | | - |
4 | | -linters-settings: |
5 | | - goimports: |
6 | | - # enforced by linter |
7 | | - # put imports beginning with prefix after 3rd-party packages; |
8 | | - # it's a comma-separated list of prefixes |
9 | | - local-prefixes: github.com/onflow/flow-go/ |
10 | | - |
11 | | - # used to generate canonical import ordering |
12 | | - # not enforced by linter |
13 | | - gci: |
14 | | - sections: |
15 | | - - standard # 1. standard library |
16 | | - - default # 2. external packages |
17 | | - - prefix(github.com/onflow/) # 3. org packages |
18 | | - - prefix(github.com/onflow/flow-go/) # 4. project packages |
19 | | - skip-generated: true |
20 | | - custom-order: true |
21 | | - |
22 | | - gosec: |
23 | | - # To select a subset of rules to run. |
24 | | - # Available rules: https://github.com/securego/gosec#available-rules |
25 | | - includes: |
26 | | - - G401 |
27 | | - - G402 |
28 | | - - G501 |
29 | | - - G502 |
30 | | - - G503 |
31 | | - - G505 |
32 | | - |
33 | | - staticcheck: |
34 | | - # Disable SA1019 to allow use of deprecated label |
35 | | - checks: ["all", "-SA1019"] |
36 | | - |
37 | | - custom: |
38 | | - structwrite: |
39 | | - type: module |
40 | | - description: "disallow struct field writes outside constructor" |
41 | | - original-url: "github.com/onflow/flow-go/tools/structwrite" |
42 | | - |
| 1 | +version: "2" |
43 | 2 | linters: |
44 | 3 | enable: |
45 | | - - goimports |
46 | 4 | - gosec |
47 | 5 | - structwrite |
| 6 | + settings: |
| 7 | + gosec: |
| 8 | + includes: |
| 9 | + - G401 |
| 10 | + - G402 |
| 11 | + - G501 |
| 12 | + - G502 |
| 13 | + - G503 |
| 14 | + - G505 |
| 15 | + staticcheck: |
| 16 | + checks: |
| 17 | + - all |
| 18 | + - -SA1019 |
48 | 19 |
|
49 | | -issues: |
50 | | - exclude-rules: |
51 | | - - path: _test\.go # disable some linters on test files |
52 | | - linters: |
53 | | - - unused |
54 | | - - structwrite |
55 | | - - path: 'consensus/hotstuff/helper/*' # disable some linters on test helper files |
56 | | - linters: |
57 | | - - structwrite |
58 | | - - path: 'utils/unittest/*' # disable some linters on test files |
59 | | - linters: |
60 | | - - structwrite |
61 | | - - path: 'consensus/hotstuff/helper/*' # disable some linters on test files |
62 | | - linters: |
63 | | - - structwrite |
64 | | - - path: 'engine/execution/testutil/*' # disable some linters on test files |
65 | | - linters: |
66 | | - - structwrite |
67 | | - # typecheck currently not handling the way we do function inheritance well |
68 | | - # disabling for now |
69 | | - - path: 'cmd/access/node_build/*' |
70 | | - linters: |
71 | | - - typecheck |
72 | | - - path: 'cmd/observer/node_builder/*' |
73 | | - linters: |
74 | | - - typecheck |
75 | | - - path: 'follower/*' |
76 | | - linters: |
77 | | - - typecheck |
| 20 | + # TODO: these were added to allow updating to the latest version of the linter. |
| 21 | + # Update the code to remove these issues instead of suppressing them. |
| 22 | + - -QF1001 # could apply De Morgan's law" were hidden |
| 23 | + - -QF1003 # could use tagged switch on chainID (staticcheck) |
| 24 | + - -QF1006 # could lift into loop condition (staticcheck) |
| 25 | + - -QF1008 # could remove embedded field \"BaseConfig\" from selector" were hidden |
| 26 | + - -QF1011 # could omit type flow.IdentifierList from declaration; it will be inferred from the right-hand side" were hidden |
| 27 | + - -QF1012 # Use fmt.Fprintf(...) instead of Write([]byte(fmt.Sprintf(...))) (staticcheck) |
| 28 | + - -S1021 # should merge variable declaration with assignment on next line (staticcheck) |
| 29 | + - -ST1003 # should not use underscores in package names" were hidden |
| 30 | + - -ST1005 # error strings should not be capitalized" were hidden |
| 31 | + - -ST1006 # receiver name should not be an underscore, omit the name if it is unused (staticcheck) |
| 32 | + - -ST1008 # error should be returned as the last argument" were hidden |
| 33 | + - -ST1012 # error var factoryError should have name of the form errFoo" were hidden |
| 34 | + - -ST1016 # methods on the same type should have the same receiver name (seen 45x "db", 4x "s") (staticcheck) |
| 35 | + - -ST1017 # don't use Yoda conditions" were hidden |
| 36 | + - -ST1019 # other import of \"github.com/onflow/flow-go/model/bootstrap\"" were hidden |
| 37 | + - -ST1023 # should omit type flow.IdentifierList from declaration; it will be inferred from the right-hand side" were hidden |
| 38 | + custom: |
| 39 | + structwrite: |
| 40 | + type: module |
| 41 | + description: disallow struct field writes outside constructor |
| 42 | + original-url: github.com/onflow/flow-go/tools/structwrite |
| 43 | + exclusions: |
| 44 | + generated: lax |
| 45 | + presets: |
| 46 | + - comments |
| 47 | + - common-false-positives |
| 48 | + - legacy |
| 49 | + - std-error-handling |
| 50 | + rules: |
| 51 | + - linters: |
| 52 | + - structwrite |
| 53 | + - unused |
| 54 | + path: _test\.go |
| 55 | + - linters: |
| 56 | + - structwrite |
| 57 | + path: consensus/hotstuff/helper/* |
| 58 | + - linters: |
| 59 | + - structwrite |
| 60 | + path: utils/unittest/* |
| 61 | + - linters: |
| 62 | + - structwrite |
| 63 | + path: consensus/hotstuff/helper/* |
| 64 | + - linters: |
| 65 | + - structwrite |
| 66 | + path: engine/execution/testutil/* |
| 67 | + paths: |
| 68 | + - third_party$ |
| 69 | + - builtin$ |
| 70 | + - examples$ |
| 71 | +formatters: |
| 72 | + enable: |
| 73 | + - goimports |
| 74 | + settings: |
| 75 | + gci: |
| 76 | + sections: |
| 77 | + - standard |
| 78 | + - default |
| 79 | + - prefix(github.com/onflow/) |
| 80 | + - prefix(github.com/onflow/flow-go/) |
| 81 | + custom-order: true |
| 82 | + goimports: |
| 83 | + local-prefixes: |
| 84 | + - github.com/onflow/flow-go/ |
| 85 | + exclusions: |
| 86 | + generated: lax |
| 87 | + paths: |
| 88 | + - third_party$ |
| 89 | + - builtin$ |
| 90 | + - examples$ |
0 commit comments