-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.golangci.yml
More file actions
125 lines (120 loc) · 4.99 KB
/
Copy path.golangci.yml
File metadata and controls
125 lines (120 loc) · 4.99 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
version: "2"
run:
timeout: 5m
linters:
default: all
disable:
# Too noisy / not useful for this project:
- cyclop # cyclomatic complexity — redundant with gocognit
- depguard # no import allow/blocklist needed
- dogsled # too many blanks — we have legitimate multi-blank assigns in test handlers
- dupl # duplicate detection too aggressive for test code
- exhaustruct # requiring all struct fields initialized is too strict
- funlen # function length limits are arbitrary
- gochecknoglobals # we have legitimate package-level vars
- gochecknoinits # we don't use init() but no need to lint for it
- gocognit # cognitive complexity limits are arbitrary
# gocyclo enabled with over=34 (see settings below)
- godox # we allow TODO/FIXME comments
- gomoddirectives # no go.mod directive restrictions needed
- gomodguard # no module allow/blocklist needed
- ireturn # returning interfaces is fine
- lll # line length limits are arbitrary
- maintidx # maintainability index is arbitrary
- mnd # magic number detection too aggressive
- nakedret # naked returns are fine in short functions
- nlreturn # blank-line-before-return is too opinionated
- nonamedreturns # we use named returns for defer cleanup
- paralleltest # not all tests benefit from t.Parallel
- testpackage # we use same-package tests for internal access
- varnamelen # variable name length limits are arbitrary
- wrapcheck # wrapping every external error is too verbose
- wsl_v5 # whitespace style is too opinionated
- wsl # deprecated, replaced by wsl_v5
- noinlineerr # disallowing `if err := ...; err != nil` is too opinionated
- err113 # requiring wrapped static errors everywhere is too strict
- tagliatelle # struct tag naming style is project-specific
- forbidigo # CLI tool legitimately uses fmt.Print for user output
- nestif # nested if limits are arbitrary
- goconst # repeated strings as constants is too aggressive
- embeddedstructfieldcheck # blank line before embedded fields is too opinionated
# Irrelevant to this project:
- arangolint # no arangodb
- ginkgolinter # no ginkgo
- gosmopolitan # no i18n
- inamedparam # too strict for interfaces
- promlinter # no prometheus
- rowserrcheck # no database/sql
- spancheck # no opentelemetry
- sqlclosecheck # no database/sql
- testifylint # no testify
- unqueryvet # no SQL
- zerologlint # no zerolog
settings:
gocyclo:
min-complexity: 32
errcheck:
exclude-functions:
- (net/http.ResponseWriter).Write
- io.Copy
- fmt.Fprintf
- fmt.Fprintln
- (io.Closer).Close
gosec:
excludes:
- G104 # unhandled errors — covered by errcheck with better exclusion control
- G117 # struct fields matching "secret" patterns — false positives on APIKey config fields
- G402 # TLS InsecureSkipVerify — handled by nolint directives where needed
- G602 # slice bounds — false positives on well-bounded iterations
- G703 # path traversal taint — config file paths are trusted input
- G704 # SSRF taint — URLs come from config, not user input
- G705 # XSS taint — CLI tool, no web output
- G706 # log injection taint — slog structured logging is safe
gocritic:
enabled-tags:
- diagnostic
- style
- performance
revive:
rules:
- name: blank-imports
- name: context-as-argument
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
- name: increment-decrement
- name: indent-error-flow
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: var-declaration
- name: var-naming
exhaustive:
default-signifies-exhaustive: true
exclusions:
generated: lax
presets:
- std-error-handling
rules:
# Test files get relaxed rules.
- path: _test\.go
linters:
- errcheck
- gosec
- errchkjson
- forcetypeassert
- noctx
# rlimit_unix.go treats only RLIM_INFINITY as unlimited and otherwise
# clamps values above platform maxInt before int conversion, making the
# conversion safe. G115 fires on Linux where Rlimit.Cur is uint64 but
# not on macOS where it is int64.
- path: internal/config/rlimit_unix\.go
text: "G115"
linters:
- gosec
issues:
max-issues-per-linter: 0
max-same-issues: 0