11# golangci-lint configuration
2- # Compatible with golangci-lint v2.1 + and Go 1.20
2+ # Compatible with golangci-lint v2.4 + and Go 1.20
33# This is a best practice starter configuration that can be gradually enhanced
44version : " 2"
55
1212 allow-parallel-runners : true
1313 # Module download mode
1414 modules-download-mode : " mod"
15- # Skip directories
16- skip-dirs :
17- - vendor
18- - third_party
19- - testdata
20- # Skip files
21- skip-files :
22- - " .*\\ .pb\\ .go$"
23- - " .*\\ .gen\\ .go$"
2415
2516# Code formatters configuration
2617formatters :
@@ -35,22 +26,21 @@ formatters:
3526 simplify : true
3627
3728 goimports :
38- # Local package prefix
39- local-prefixes : github.com/moond4rk/hackbrowserdata
29+ # Local package prefix (must be array in v2)
30+ local-prefixes :
31+ - github.com/moond4rk/hackbrowserdata
4032
4133 gci :
4234 # Import section order
4335 sections :
4436 - standard # Standard library
4537 - default # Third-party libraries
4638 - prefix(github.com/moond4rk/hackbrowserdata) # Local packages
47- skip-generated : true
48- custom-order : true
4939
5040# Linter configuration
5141linters :
52- # Use minimal defaults, then explicitly enable needed linters
53- disable-all : false
42+ # Use standard linters as base
43+ default : standard
5444
5545 # Additional enabled linters (best practices recommended)
5646 enable :
@@ -74,8 +64,6 @@ linters:
7464 - whitespace # Whitespace checks
7565
7666 # Best practices
77- - govet # Go vet checks
78- - staticcheck # Static analysis (includes gosimple, stylecheck)
7967 - gocritic # Comprehensive code analysis
8068 - goprintffuncname # Printf function naming checks
8169
@@ -98,7 +86,72 @@ linters:
9886 - gochecknoglobals # No global variables (sometimes needed)
9987 - gochecknoinits # No init functions (sometimes needed)
10088 - exhaustive # Enum completeness (too strict initially)
101- - unused # Temporarily disabled - will enable later
89+ - unused # Temporarily disabled for gradual cleanup
90+
91+ # Exclusion configuration
92+ exclusions :
93+ # Paths to exclude
94+ paths :
95+ - vendor
96+ - third_party
97+ - testdata
98+ - " .*\\ .pb\\ .go$"
99+ - " .*\\ .gen\\ .go$"
100+
101+ # Use default exclusion presets
102+ presets :
103+ - comments
104+ - common-false-positives
105+ - legacy
106+ - std-error-handling
107+
108+ # Exclusion rules
109+ rules :
110+ # Test file exclusions
111+ - path : ' _test\.go'
112+ linters :
113+ - dupl
114+ - funlen
115+ - goconst
116+ - gosec
117+ - errcheck
118+
119+ # Generated file exclusions
120+ - path : ' \.pb\.go$'
121+ linters :
122+ - all
123+
124+ # Vendor directory exclusions
125+ - path : " vendor"
126+ linters :
127+ - all
128+
129+ # Defer statement exclusions
130+ - source : " defer"
131+ linters :
132+ - errcheck
133+
134+ # SQL query exclusions
135+ - text : " SELECT"
136+ linters :
137+ - gosec
138+
139+ # Package comment exclusions
140+ - text : " should have a package comment"
141+ linters :
142+ - staticcheck
143+ - revive
144+
145+ # Types package exclusions
146+ - path : " types/types.go"
147+ linters :
148+ - revive
149+
150+ # Unused code exclusions (temporary)
151+ - text : " is unused"
152+ linters :
153+ - unused
154+ - staticcheck
102155
103156 # Linter specific settings
104157 settings :
@@ -142,15 +195,20 @@ linters:
142195
143196 # Static check settings
144197 staticcheck :
145- # Go version
146- go : " 1.20"
147198 # Check all except the ones we exclude
148- checks : ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022"]
199+ checks :
200+ [
201+ " all" ,
202+ " -ST1000" ,
203+ " -ST1003" ,
204+ " -ST1016" ,
205+ " -ST1020" ,
206+ " -ST1021" ,
207+ " -ST1022" ,
208+ ]
149209
150210 # Revive settings
151211 revive :
152- # Ignore generated files
153- ignore-generated-header : true
154212 severity : warning
155213 rules :
156214 - name : unused-parameter
@@ -205,106 +263,10 @@ linters:
205263 min-len : 5 # Minimum length of string constant
206264 min-occurrences : 5 # Increased from default 3
207265
208- # Issue exclusion rules
209- issues :
210- # Don't use default exclusion rules
211- exclude-use-default : false
212-
213- # Global exclusion rules - expanded to reduce noise
214- exclude :
215- # Comment related
216- - " should have a package comment"
217- - " should have comment"
218- - " comment on exported"
219- - " ST1000" # Package comments
220- - " at least one file in a package should have a package comment"
221-
222- # Error handling (handled by errcheck)
223- - " Error return value of .* is not checked"
224- - " error return value not checked"
225-
226- # Test related
227- - " don't use ALL_CAPS in Go names"
228-
229- # Security related false positives
230- - " G101: Potential hardcoded credentials"
231- - " G502: Blocklisted import"
232- - " G405: Use of weak cryptographic primitive"
233-
234- # Naming issues
235- - " var-naming: avoid meaningless package names"
236-
237- # Defer in loop - sometimes needed
238- - " defer statement in loop"
239-
240- # Unused code - will clean up later
241- - " field .* is unused"
242- - " func .* is unused"
243-
244- # Conditional exclusion rules
245- exclude-rules :
246- # Special rules for test files
247- - path : ' _test\.go'
248- linters :
249- - dupl # Test code can be duplicated
250- - funlen # Test functions can be longer
251- - goconst # Tests can have magic numbers
252- - gosec # Tests have lower security requirements
253- - errcheck # Tests don't need all error checks
254-
255- # Generated file exclusions
256- - path : ' \.pb\.go$'
257- linters :
258- - all
259-
260- # Specific directory exclusions
261- - path : " vendor"
262- linters :
263- - all
264-
265- # Exclude errcheck for defer statements
266- - source : " defer"
267- linters :
268- - errcheck
269-
270- # Exclude gosec G101 for SQL queries
271- - text : " SELECT"
272- linters :
273- - gosec
274-
275- # Exclude package comment requirements
276- - text : " should have a package comment"
277- linters :
278- - staticcheck
279- - revive
280-
281- # Exclude var-naming for types package
282- - path : " types/types.go"
283- linters :
284- - revive
285-
286- # Exclude unused checks temporarily
287- - text : " is unused"
288- linters :
289- - unused
290- - staticcheck
291-
292- # Maximum issue limits
293- max-issues-per-linter : 0 # No limit
294- max-same-issues : 0 # No limit on duplicate issues
295-
296266# Output configuration
297267output :
298- # Output format
268+ # Output format - use text format with colors
299269 formats :
300- colored-line-number :
270+ text :
301271 path : stdout
302-
303- # Sort by severity
304- sort-results : true
305-
306- # Print linter name
307- print-linter-name : true
308-
309- # Show all issues (no truncation)
310- uniq-by-line : false
272+ colors : true
0 commit comments