-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yml
More file actions
117 lines (101 loc) 路 3.42 KB
/
Copy path.golangci.yml
File metadata and controls
117 lines (101 loc) 路 3.42 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
# golangci-lint configuration for bskyoauth
# See: https://golangci-lint.run/usage/configuration/
run:
timeout: 5m
tests: true
modules-download-mode: readonly
linters:
enable:
- errcheck # Check for unchecked errors
- gosimple # Simplify code
- govet # Vet examines Go source code
- ineffassign # Detect ineffectual assignments
- staticcheck # Advanced Go linter
- unused # Check for unused code
- gofmt # Check code formatting
- goimports # Check import formatting
- misspell # Check for misspelled words
- revive # Fast, configurable, extensible linter
- gosec # Security-focused linter
- unconvert # Remove unnecessary type conversions
- unparam # Find unused function parameters
- prealloc # Find slice declarations that could be preallocated
- nilerr # Find code that returns nil even if it checks that the error is not nil
linters-settings:
errcheck:
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`
check-type-assertions: false
# Exclude these functions from error checking
exclude-functions:
- (github.com/shindakun/bskyoauth/vendor/github.com/whyrusleeping/cbor-gen.WriteMajorTypeHeader)
- (*encoding/json.Encoder).Encode
- (io.ReadCloser).Close
- (crypto/rand.Read)
govet:
# Enable all analyzers
enable-all: true
# Disable some checks that can be too noisy
disable:
- shadow
- fieldalignment # Performance optimization, not critical
revive:
# Enable all rules
rules:
- name: exported
disabled: false
arguments:
- "checkPrivateReceivers"
- "sayRepetitiveInsteadOfStutters"
gosec:
# Only check high and medium severity issues
severity: medium
confidence: medium
excludes:
- G104 # Allow unhandled errors in defer statements
- G115 # Allow integer conversions (overflow check not critical for our use case)
- G304 # Allow file path from variable (necessary for our use case)
- G404 # Allow weak random number generator for non-security purposes
misspell:
locale: US
goimports:
local-prefixes: github.com/shindakun/bskyoauth
issues:
# Maximum issues count per one linter
max-issues-per-linter: 0
# Maximum count of issues with the same text
max-same-issues: 0
# Exclude some linters from running on tests files
exclude-rules:
# Exclude some linters from running on tests files
- path: _test\.go
linters:
- gosec
- errcheck
- unparam
- staticcheck
# Exclude unparam for test helper functions
- path: jwt\.go
linters:
- unparam
# Exclude known false positives
- text: "weak cryptographic primitive"
linters:
- gosec
# Exclude SA5011 (nil pointer dereference after explicit nil check)
- text: "SA5011"
linters:
- staticcheck
# Exclude rand.Read error checking (crypto/rand.Read returns error only in very rare cases)
- text: "Error return value of `rand.Read` is not checked"
linters:
- errcheck
# Exclude deprecated warnings for dependencies we don't control
- path: vendor/
linters:
- staticcheck
output:
formats:
- format: colored-line-number
print-issued-lines: true
print-linter-name: true
sort-results: true