...
1run:
2 skip-dirs:
3 - pkg/etw/sample
4
5linters:
6 enable:
7 # style
8 - containedctx # struct contains a context
9 - dupl # duplicate code
10 - errname # erorrs are named correctly
11 - nolintlint # "//nolint" directives are properly explained
12 - revive # golint replacement
13 - unconvert # unnecessary conversions
14 - wastedassign
15
16 # bugs, performance, unused, etc ...
17 - contextcheck # function uses a non-inherited context
18 - errorlint # errors not wrapped for 1.13
19 - exhaustive # check exhaustiveness of enum switch statements
20 - gofmt # files are gofmt'ed
21 - gosec # security
22 - nilerr # returns nil even with non-nil error
23 - unparam # unused function params
24
25issues:
26 exclude-rules:
27 # err is very often shadowed in nested scopes
28 - linters:
29 - govet
30 text: '^shadow: declaration of "err" shadows declaration'
31
32 # ignore long lines for skip autogen directives
33 - linters:
34 - revive
35 text: "^line-length-limit: "
36 source: "^//(go:generate|sys) "
37
38 #TODO: remove after upgrading to go1.18
39 # ignore comment spacing for nolint and sys directives
40 - linters:
41 - revive
42 text: "^comment-spacings: no space between comment delimiter and comment text"
43 source: "//(cspell:|nolint:|sys |todo)"
44
45 # not on go 1.18 yet, so no any
46 - linters:
47 - revive
48 text: "^use-any: since GO 1.18 'interface{}' can be replaced by 'any'"
49
50 # allow unjustified ignores of error checks in defer statements
51 - linters:
52 - nolintlint
53 text: "^directive `//nolint:errcheck` should provide explanation"
54 source: '^\s*defer '
55
56 # allow unjustified ignores of error lints for io.EOF
57 - linters:
58 - nolintlint
59 text: "^directive `//nolint:errorlint` should provide explanation"
60 source: '[=|!]= io.EOF'
61
62
63linters-settings:
64 exhaustive:
65 default-signifies-exhaustive: true
66 govet:
67 enable-all: true
68 disable:
69 # struct order is often for Win32 compat
70 # also, ignore pointer bytes/GC issues for now until performance becomes an issue
71 - fieldalignment
72 check-shadowing: true
73 nolintlint:
74 allow-leading-space: false
75 require-explanation: true
76 require-specific: true
77 revive:
78 # revive is more configurable than static check, so likely the preferred alternative to static-check
79 # (once the perf issue is solved: https://github.com/golangci/golangci-lint/issues/2997)
80 enable-all-rules:
81 true
82 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md
83 rules:
84 # rules with required arguments
85 - name: argument-limit
86 disabled: true
87 - name: banned-characters
88 disabled: true
89 - name: cognitive-complexity
90 disabled: true
91 - name: cyclomatic
92 disabled: true
93 - name: file-header
94 disabled: true
95 - name: function-length
96 disabled: true
97 - name: function-result-limit
98 disabled: true
99 - name: max-public-structs
100 disabled: true
101 # geneally annoying rules
102 - name: add-constant # complains about any and all strings and integers
103 disabled: true
104 - name: confusing-naming # we frequently use "Foo()" and "foo()" together
105 disabled: true
106 - name: flag-parameter # excessive, and a common idiom we use
107 disabled: true
108 - name: unhandled-error # warns over common fmt.Print* and io.Close; rely on errcheck instead
109 disabled: true
110 # general config
111 - name: line-length-limit
112 arguments:
113 - 140
114 - name: var-naming
115 arguments:
116 - []
117 - - CID
118 - CRI
119 - CTRD
120 - DACL
121 - DLL
122 - DOS
123 - ETW
124 - FSCTL
125 - GCS
126 - GMSA
127 - HCS
128 - HV
129 - IO
130 - LCOW
131 - LDAP
132 - LPAC
133 - LTSC
134 - MMIO
135 - NT
136 - OCI
137 - PMEM
138 - PWSH
139 - RX
140 - SACl
141 - SID
142 - SMB
143 - TX
144 - VHD
145 - VHDX
146 - VMID
147 - VPCI
148 - WCOW
149 - WIM
View as plain text