|
1 | 1 | linters-settings: |
2 | 2 | exhaustive: |
3 | 3 | default-signifies-exhaustive: true |
4 | | - |
5 | 4 | gocritic: |
6 | 5 | # The list of supported checkers can be find in https://go-critic.github.io/overview. |
7 | 6 | settings: |
8 | 7 | underef: |
9 | 8 | # Whether to skip (*x).method() calls where x is a pointer receiver. |
10 | 9 | skipRecvDeref: false |
11 | | - |
| 10 | + ruleguard: |
| 11 | + rules: ${configDir}/tools/rules.go |
| 12 | + enabled-checks: |
| 13 | + - ruleguard |
12 | 14 | govet: |
13 | 15 | enable-all: true |
14 | 16 | disable: |
15 | | - - fieldalignment # too strict |
16 | | - - shadow # complains too much about shadowing errors. All research points to this being fine. |
17 | | - |
| 17 | + - fieldalignment # too strict |
| 18 | + - shadow # complains too much about shadowing errors. All research points to this being fine. |
18 | 19 | nakedret: |
19 | 20 | max-func-lines: 0 |
20 | | - |
21 | 21 | nolintlint: |
22 | | - allow-no-explanation: [ forbidigo, tracecheck, gomnd, gochecknoinits, makezero ] |
| 22 | + allow-no-explanation: [forbidigo, tracecheck, gomnd, gochecknoinits, makezero] |
23 | 23 | require-explanation: true |
24 | 24 | require-specific: true |
25 | | - |
26 | 25 | revive: |
27 | 26 | ignore-generated-header: true |
28 | 27 | severity: error |
29 | 28 | rules: |
30 | | - - name: atomic |
31 | | - - name: line-length-limit |
32 | | - arguments: [ 200 ] |
33 | | - # These are functions that we use without checking the errors often. Most of these can't return an error even |
34 | | - # though they implement an interface that can. |
35 | | - - name: unhandled-error |
36 | | - arguments: |
37 | | - - fmt.Printf |
38 | | - - fmt.Println |
39 | | - - fmt.Fprintf |
40 | | - - fmt.Fprintln |
41 | | - - os.Stderr.Sync |
42 | | - - sb.WriteString |
43 | | - - buf.WriteString |
44 | | - - hasher.Write |
45 | | - - os.Setenv |
46 | | - - os.RemoveAll |
47 | | - - name: var-naming |
48 | | - arguments: [ [ "ID", "URL", "HTTP", "API" ], [] ] |
49 | | - |
| 29 | + - name: atomic |
| 30 | + - name: line-length-limit |
| 31 | + arguments: [200] |
| 32 | + # These are functions that we use without checking the errors often. Most of these can't return an error even |
| 33 | + # though they implement an interface that can. |
| 34 | + - name: unhandled-error |
| 35 | + arguments: |
| 36 | + - fmt.Printf |
| 37 | + - fmt.Println |
| 38 | + - fmt.Fprintf |
| 39 | + - fmt.Fprintln |
| 40 | + - os.Stderr.Sync |
| 41 | + - sb.WriteString |
| 42 | + - buf.WriteString |
| 43 | + - hasher.Write |
| 44 | + - os.Setenv |
| 45 | + - os.RemoveAll |
| 46 | + - name: var-naming |
| 47 | + arguments: [["ID", "URL", "HTTP", "API"], []] |
50 | 48 | tenv: |
51 | 49 | all: true |
52 | | - |
53 | 50 | varcheck: |
54 | 51 | exported-fields: false # this appears to improperly detect exported variables as unused when they are used from a package with the same name |
55 | | - |
56 | 52 | linters: |
57 | 53 | disable-all: true |
58 | 54 | enable: |
59 | | - - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases |
60 | | - - gosimple # Linter for Go source code that specializes in simplifying a code |
61 | | - - govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string |
62 | | - - ineffassign # Detects when assignments to existing variables are not used |
63 | | - - staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks |
64 | | - - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code |
65 | | - - unused # Checks Go code for unused constants, variables, functions and types |
66 | | - - asasalint # Check for pass []any as any in variadic func(...any) |
67 | | - - asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers |
68 | | - - bidichk # Checks for dangerous unicode character sequences |
69 | | - - bodyclose # checks whether HTTP response body is closed successfully |
70 | | - - durationcheck # check for two durations multiplied together |
71 | | - - errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. |
72 | | - - exhaustive # check exhaustiveness of enum switch statements |
73 | | - - copyloopvar # checks for pointers to enclosing loop variables |
74 | | - - forbidigo # Forbids identifiers |
75 | | - - gochecknoinits # Checks that no init functions are present in Go code |
76 | | - - goconst # Finds repeated strings that could be replaced by a constant |
77 | | - - gocritic # Provides diagnostics that check for bugs, performance and style issues. |
78 | | - - godot # Check if comments end in a period |
79 | | - - goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt. |
80 | | - - gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. |
81 | | - - goprintffuncname # Checks that printf-like functions are named with f at the end |
82 | | - - gosec # Inspects source code for security problems |
83 | | - - nakedret # Finds naked returns in functions greater than a specified function length |
84 | | - - nilerr # Finds the code that returns nil even if it checks that the error is not nil. |
85 | | - - noctx # noctx finds sending http request without context.Context |
86 | | - - nolintlint # Reports ill-formed or insufficient nolint directives |
87 | | - - nonamedreturns # Reports all named returns |
88 | | - - nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL. |
89 | | - - predeclared # find code that shadows one of Go's predeclared identifiers |
90 | | - - revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. |
91 | | - - tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 |
92 | | - - tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes |
93 | | - - unconvert # Remove unnecessary type conversions |
94 | | - - usestdlibvars # detect the possibility to use variables/constants from the Go standard library |
95 | | - - whitespace # Tool for detection of leading and trailing whitespace |
96 | | - |
| 55 | + - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases |
| 56 | + - gosimple # Linter for Go source code that specializes in simplifying a code |
| 57 | + - govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string |
| 58 | + - ineffassign # Detects when assignments to existing variables are not used |
| 59 | + - staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks |
| 60 | + - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code |
| 61 | + - unused # Checks Go code for unused constants, variables, functions and types |
| 62 | + - asasalint # Check for pass []any as any in variadic func(...any) |
| 63 | + - asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers |
| 64 | + - bidichk # Checks for dangerous unicode character sequences |
| 65 | + - bodyclose # checks whether HTTP response body is closed successfully |
| 66 | + - durationcheck # check for two durations multiplied together |
| 67 | + - errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. |
| 68 | + - exhaustive # check exhaustiveness of enum switch statements |
| 69 | + - copyloopvar # checks for pointers to enclosing loop variables |
| 70 | + - forbidigo # Forbids identifiers |
| 71 | + - gochecknoinits # Checks that no init functions are present in Go code |
| 72 | + - goconst # Finds repeated strings that could be replaced by a constant |
| 73 | + - gocritic # Provides diagnostics that check for bugs, performance and style issues. |
| 74 | + - godot # Check if comments end in a period |
| 75 | + - goimports # In addition to fixing imports, goimports also formats your code in the same style as gofmt. |
| 76 | + - gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. |
| 77 | + - goprintffuncname # Checks that printf-like functions are named with f at the end |
| 78 | + - gosec # Inspects source code for security problems |
| 79 | + - nakedret # Finds naked returns in functions greater than a specified function length |
| 80 | + - nilerr # Finds the code that returns nil even if it checks that the error is not nil. |
| 81 | + - noctx # noctx finds sending http request without context.Context |
| 82 | + - nolintlint # Reports ill-formed or insufficient nolint directives |
| 83 | + - nonamedreturns # Reports all named returns |
| 84 | + - nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL. |
| 85 | + - predeclared # find code that shadows one of Go's predeclared identifiers |
| 86 | + - revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. |
| 87 | + - tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 |
| 88 | + - tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes |
| 89 | + - unconvert # Remove unnecessary type conversions |
| 90 | + - usestdlibvars # detect the possibility to use variables/constants from the Go standard library |
| 91 | + - whitespace # Tool for detection of leading and trailing whitespace |
97 | 92 | issues: |
98 | 93 | max-same-issues: 50 |
99 | | - |
100 | 94 | exclude-rules: |
101 | | - # Don't require TODO comments to end in a period |
102 | | - - source: "(TODO)" |
103 | | - linters: [ godot ] |
| 95 | + # Don't require TODO comments to end in a period |
| 96 | + - source: "(TODO)" |
| 97 | + linters: [godot] |
0 commit comments