-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yml
More file actions
113 lines (104 loc) · 4.28 KB
/
.golangci.yml
File metadata and controls
113 lines (104 loc) · 4.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
version: "2"
linters:
enable:
# Bug finders
- asciicheck # Non-ASCII identifiers
- bidichk # Dangerous unicode sequences
- bodyclose # HTTP response body closure
- durationcheck # Duration multiplication bugs
- embeddedstructfieldcheck # Embedded struct field access issues
- errcheck # Unchecked errors
- errorlint # Error wrapping issues
- errchkjson # JSON encoding error checks
- errname # Error naming conventions
- fatcontext # Context misuse in loops
- forcetypeassert # Unchecked type assertions
- ineffassign # Ineffective assignments
- nilerr # Returns nil even when error set
- noctx # Missing context.Context usage
- nosprintfhostport # URL construction bugs
- staticcheck # Comprehensive static analysis
- unused # Unused code
# Security
- gosec # Security issues
# Code quality
- cyclop # Cyclomatic complexity
- dupl # Duplicated code blocks
- gochecknoglobals # Disallow global variables
- gochecknoinits # Disallow init functions
- godot # Check comment ending with period
- nestif # Deeply nested if statements
- nlreturn # Newline before return
- canonicalheader # HTTP header canonicalization
- dupword # Duplicate words (typos)
- exhaustive # Exhaustive switch statements
- funcorder # Function declaration order
- goconst # Repeated strings that could be constants
- gocritic # Bugs, performance, style issues
- intrange # Use range over integers (Go 1.22+)
- mirror # bytes/strings usage patterns
- misspell # Typos
- modernize # Suggest modern Go idioms
- perfsprint # Faster alternatives to fmt.Sprintf
- predeclared # Shadowing predeclared identifiers
- unconvert # Unnecessary type conversions
- unparam # Unused function parameters
- usestdlibvars # Use stdlib constants
- wastedassign # Wasted assignments
# Test quality
- nolintlint # Validate nolint directives
- paralleltest # Parallel test best practices
- testifylint # Testify usage
- thelper # Test helper best practices
- usetesting # Use testing package features
settings:
goconst:
min-occurrences: 3
paralleltest:
ignore-missing-subtests: true
gosec:
excludes:
- G115 # Integer overflow - checked at runtime
- G304 # File path from variable - paths are from config
- G301 # Directory permissions 0755 - standard for non-sensitive
- G306 # File permissions 0644 - standard for non-sensitive
- G401 # MD5 - required by API protocol
- G404 # math/rand - ok for sensor data simulation
- G501 # MD5 import - required by API protocol
exclusions:
rules:
# Sensor data uses append to build new slices intentionally
- path: internal/sensordata/
linters:
- gocritic
text: appendAssign
# Test files can have repeated strings and controlled type assertions
- path: _test\.go
linters:
- goconst
- forcetypeassert
# Global variables - justified exclusions:
# 1. Version set by ldflags at build time
- path: cmd/mcs/main\.go
linters:
- gochecknoglobals
text: Version
# 3. Read-only lookup tables (RegionConfigs, screenSizes, androidVersionToSDK)
- path: internal/api/auth\.go
linters:
- gochecknoglobals
text: RegionConfigs
- path: internal/sensordata/system_info\.go
linters:
- gochecknoglobals
text: (screenSizes|androidVersionToSDK)
# 4. Color state management - global state needed for CLI output formatting
- path: internal/cli/color\.go
linters:
- gochecknoglobals
text: (colorEnabled|colorMu)
# 5. Test helper mutex for serializing parallel tests
- path: internal/cli/color_test\.go
linters:
- gochecknoglobals
text: colorTestMutex