-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yml
More file actions
136 lines (112 loc) · 3.08 KB
/
Copy path.golangci.yml
File metadata and controls
136 lines (112 loc) · 3.08 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# MarkGo Engine - GolangCI-Lint v2 Configuration
# Balanced static analysis for Go code - high quality without excessive strictness
version: "2"
run:
timeout: 5m
tests: true
modules-download-mode: readonly
output:
formats:
text:
print-issued-lines: true
print-linter-name: true
colors: true
linters:
default: none
enable:
# Core linters - essential for code correctness
- errcheck # Check for unchecked errors
- govet # Go vet tool with shadow detection
- ineffassign # Detect ineffectual assignments
- staticcheck # Static analysis checks
- unused # Find unused variables/functions
# Style and formatting - maintain consistency
- revive # Replacement for golint with better rules
# Security - important for production code
- gosec # Security audit
# Code quality - reasonable checks
- gocyclo # Cyclomatic complexity (relaxed to 20)
- goconst # Find repeated strings that could be constants
- gocritic # Code analysis (without experimental/opinionated)
- misspell # Spell checking
settings:
errcheck:
check-type-assertions: true
check-blank: true
goconst:
min-len: 3
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- performance
- style
disabled-checks:
- commentedOutCode
- whyNoLint
- unnamedResult
- unlambda
gocyclo:
min-complexity: 20
govet:
enable:
- shadow
misspell:
locale: US
revive:
rules:
- name: exported
severity: warning
disabled: false
arguments:
- "checkPrivateReceivers"
- "sayRepetitiveInsteadOfStutters"
exclusions:
paths:
- vendor
- tmp
- todos
rules:
# Relax rules for test files
- path: _test\.go
linters:
- gocyclo
- errcheck
- gosec
- goconst
- misspell
# Relax rules for cmd/ packages (main packages often need flexibility)
- path: cmd/
linters:
- revive
- gosec
- gocyclo
- gocritic
- errcheck
- goconst
- misspell
# Allow missing comments in internal packages
- path: internal/
linters:
- revive
text: "should have comment"
# Allow HTML template functions (common in web apps)
- linters:
- gosec
text: "G203.*HTML.*auto-escape"
# Allow some common Go patterns
- linters:
- gosec
text: "G204.*subprocess.*variable"
# Standard Go patterns that are acceptable
- path: '(.+)\.go$'
text: "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*printf?|os\\.(Un)?Setenv). is not checked"
# Allow defer in loops for resource cleanup
- path: '(.+)\.go$'
text: "G307.*defer.*loop"
presets: []
issues:
max-issues-per-linter: 0
max-same-issues: 0
severity:
default: error