-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy path.golangci.yml
More file actions
196 lines (186 loc) · 6.65 KB
/
Copy path.golangci.yml
File metadata and controls
196 lines (186 loc) · 6.65 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# golangci-lint configuration file
# Documentation: https://golangci-lint.run/usage/configuration/
# Version: 2 (latest configuration format)
# Configuration version - must be "2" for latest golangci-lint
version: "2"
# Options for analysis running
run:
# Module download mode for go list command
# Options: readonly, vendor, mod, sum
# readonly: prevents automatic go.mod updates (recommended for CI)
modules-download-mode: readonly
# Include test files in linting analysis
# Default: true, but disabled for this project to focus on main code
tests: false
# Allow multiple parallel golangci-lint instances running
# Useful for CI environments with multiple jobs
allow-parallel-runners: true
# Output configuration
output:
formats:
# Text format output to stderr with colors
text:
path: stderr
# Linter configuration
linters:
# Enable all available linters by default
default: all
# Enable custom linters
enable:
- attgo
# Disable specific linters that are too strict or generate false positives
disable:
- cyclop # Disable cyclomatic complexity check
- depguard # Disable dependency guard check
- dupl # Disable duplicate code check
- err113 # Disable error 113 check
- exhaustive # Disable exhaustive check
- exhaustruct # Disable exhaustruct check
- forcetypeassert # Disable force type assert check
- funlen # Disable function length check
- gochecknoglobals # Disable global variable check
- gochecknoinits # Disable global variable check
- gocognit # Disable cognitive complexity check
- goconst # Disable constant check
- intrange # Disable integer range check
- ireturn # Disable return check
- lll # Disable line length check
- maintidx # Disable maintainability index check
- mnd # Disable magic number check
- musttag # Disable must tag check
- perfsprint # Disable performance sprint check
- recvcheck # Disable receive check
- varnamelen # Disable variable name length check
- wrapcheck # Disable wrap check
- wsl # Disable whitespace check for line length
- wsl_v5 # Disable whitespace check for line length
- noinlineerr # Disable inline error check
- funcorder # Disable function order check
# Linter-specific settings and configurations
settings:
# goheader: License header validation
goheader:
values:
regexp:
# Regex pattern for matching copyright years
YEARS: (20\d\d - 20\d\d|20\d\d, 20\d\d|20\d\d)
# Template for required license header
template: |-
Copyright © {{ YEARS }} Attestant Limited.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
# gosec: Security vulnerability scanning
gosec:
excludes:
# Exclude G115: Use of ReadAll is discouraged (false positives)
- G115
# lll: Line length linter (disabled but configured for reference)
lll:
line-length: 132
# revive: Advanced Go linter with extensive rules
revive:
# Minimum confidence level for reporting issues
confidence: 0.8
# Severity level for violations
severity: error
# Enable all available rules
enable-all-rules: true
rules:
# Disable specific revive rules
- name: add-constant
disabled: true
- name: cyclomatic
disabled: true
- name: cognitive-complexity
disabled: true
- name: function-length
disabled: true
- name: max-public-structs
disabled: true
- name: package-comments
disabled: true
- name: package-directory-mismatch
disabled: true
- name: var-naming
disabled: true
# Configure specific rules
- name: confusing-results
- name: line-length-limit
arguments:
- 132
- name: struct-tag
arguments:
- json,allowempty
- name: unhandled-error
arguments:
- fmt.Fprint
- fmt.Fprintf
# staticcheck: Advanced static analysis
staticcheck:
checks:
# Enable all checks except ST1000 (package comment style)
- all
- -ST1000
# tagliatelle: Struct tag naming conventions
tagliatelle:
case:
rules:
# Use snake_case for JSON and YAML tags
json: snake
yaml: snake
# attgo-linter: Attestant organization coding standards
custom:
attgo:
type: "module"
description: "Attestant organization style linter"
settings:
# HIGH PRIORITY
enable_no_pkg_logger: false
enable_enum_iota: true
enable_current_year: false
# MEDIUM PRIORITY
enable_capital_comment: false
enable_func_opts: true
enable_raw_string: true
# LOW PRIORITY
enable_struct_field_order: false
enable_interface_check: true
# Exclusions: Files and patterns to exclude from linting
exclusions:
# Exclude generated files with lax matching
generated: lax
# Exclude common false positive presets
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
# Exclude specific file patterns
paths:
- .*_ssz\.go$ # Exclude SSZ generated files
- third_party$ # Exclude third party code
- builtin$ # Exclude builtin code
- examples$ # Exclude example code
# Formatters: Code formatting tools
formatters:
enable:
- gofmt # Standard Go formatter
- gofumpt # Stricter Go formatter
- goimports # Import organization and formatting
- gci # Go import grouping and sorting formatter
exclusions:
# Exclude generated files from formatting
generated: lax
# Exclude specific file patterns from formatting
paths:
- .*_ssz\.go$ # Exclude SSZ generated files
- third_party$ # Exclude third party code
- builtin$ # Exclude builtin code
- examples$ # Exclude example code