main
1linters:
2 enable:
3 # style
4 - containedctx # struct contains a context
5 - dupl # duplicate code
6 - errname # erorrs are named correctly
7 - nolintlint # "//nolint" directives are properly explained
8 - revive # golint replacement
9 - unconvert # unnecessary conversions
10 - wastedassign
11
12 # bugs, performance, unused, etc ...
13 - contextcheck # function uses a non-inherited context
14 - errorlint # errors not wrapped for 1.13
15 - exhaustive # check exhaustiveness of enum switch statements
16 - gofmt # files are gofmt'ed
17 - gosec # security
18 - nilerr # returns nil even with non-nil error
19 - thelper # test helpers without t.Helper()
20 - unparam # unused function params
21
22issues:
23 exclude-dirs:
24 - pkg/etw/sample
25
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 nolintlint:
73 require-explanation: true
74 require-specific: true
75 revive:
76 # revive is more configurable than static check, so likely the preferred alternative to static-check
77 # (once the perf issue is solved: https://github.com/golangci/golangci-lint/issues/2997)
78 enable-all-rules:
79 true
80 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md
81 rules:
82 # rules with required arguments
83 - name: argument-limit
84 disabled: true
85 - name: banned-characters
86 disabled: true
87 - name: cognitive-complexity
88 disabled: true
89 - name: cyclomatic
90 disabled: true
91 - name: file-header
92 disabled: true
93 - name: function-length
94 disabled: true
95 - name: function-result-limit
96 disabled: true
97 - name: max-public-structs
98 disabled: true
99 # geneally annoying rules
100 - name: add-constant # complains about any and all strings and integers
101 disabled: true
102 - name: confusing-naming # we frequently use "Foo()" and "foo()" together
103 disabled: true
104 - name: flag-parameter # excessive, and a common idiom we use
105 disabled: true
106 - name: unhandled-error # warns over common fmt.Print* and io.Close; rely on errcheck instead
107 disabled: true
108 # general config
109 - name: line-length-limit
110 arguments:
111 - 140
112 - name: var-naming
113 arguments:
114 - []
115 - - CID
116 - CRI
117 - CTRD
118 - DACL
119 - DLL
120 - DOS
121 - ETW
122 - FSCTL
123 - GCS
124 - GMSA
125 - HCS
126 - HV
127 - IO
128 - LCOW
129 - LDAP
130 - LPAC
131 - LTSC
132 - MMIO
133 - NT
134 - OCI
135 - PMEM
136 - PWSH
137 - RX
138 - SACl
139 - SID
140 - SMB
141 - TX
142 - VHD
143 - VHDX
144 - VMID
145 - VPCI
146 - WCOW
147 - WIM