-
Notifications
You must be signed in to change notification settings - Fork 9
/
.golangci.yml
162 lines (158 loc) · 6.33 KB
/
.golangci.yml
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
linters-settings:
errcheck:
# report about not checking of errors in type assertions: `a := b.(MyStruct)`;
# default is false: such cases aren't reported by default.
check-type-assertions: true
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: false
goconst:
# minimal occurrences count to trigger, 3 by default
min-occurrences: 5
gocritic:
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- whyNoLint
- emptyStringTest
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/platformsh/platformify
revive:
# minimal confidence for issues, default is 0.8
min-confidence: 0
govet:
# report about shadowed variables
check-shadowing: true
lll:
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
line-length: 120
misspell:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
locale: US
nolintlint:
# Enable to ensure that nolint directives are all used. Default is true.
allow-unused: false
# Require to specify linter that is being skipped. Default is false
require-specific: true
prealloc:
# Report preallocation suggestions on for loops, false by default
for-loops: true
linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
# Simple linter to check that your code does not contain non-ASCII identifiers
# - asciicheck
# checks whether HTTP response body is closed successfully
- bodyclose
# Go linter that checks if package imports are in a list of acceptable packages
# - depguard
# Checks assignments with too many blank identifiers (e.g. x, , , _, := f())
- dogsled
# Tool for code clone detection
# - dupl
# Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
- errcheck
# Tool for detection of long functions
# - funlen
# Checks that no globals are present in Go code
# - gochecknoglobals
# Checks that no init functions are present in Go code
# - gochecknoinits
# Computes and checks the cognitive complexity of functions
# - gocognit
# Finds repeated strings that could be replaced by a constant
- goconst
# The most opinionated Go source code linter
- gocritic
# Computes and checks the cyclomatic complexity of functions
# - gocyclo
# Check if comments end in a period
# - godot
# Tool for detection of FIXME, TODO and other comment keywords
# - godox
# Golang linter to check the errors handling expressions
# - goerr113
# Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
- gofmt
# Goimports does everything that gofmt does. Additionally, it checks unused imports
- goimports
# Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes
- revive
# An analyzer to detect magic numbers.
# - gomnd
# Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations.
# - gomodguard
# Checks that printf-like functions are named with f at the end
- goprintffuncname
# Inspects source code for security problems
# - gosec
# Linter for Go source code that specializes in simplifying a code
- gosimple
# Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
- govet
# Detects when assignments to existing variables are not used
- ineffassign
# Linter that suggests narrower interface types
# - interfacer
# Reports long lines
- lll
# Tool to detect Go structs that would take less memory if their fields were sorted
# - maligned
# Finds commonly misspelled English words in comments
- misspell
# (?) Finds naked returns in functions greater than a specified function length
- nakedret
# Reports deeply nested if statements
# - nestif
# Reports ill-formed or insufficient nolint directives
- nolintlint
# Finds slice declarations that could potentially be preallocated
- prealloc
# checks whether Err of rows is checked successfully
# rowserrcheck is disabled because of generics. See https://github.com/golangci/golangci-lint/issues/2649.
# - rowserrcheck
# Scopelint checks for unpinned variables in go programs
# - scopelint
# Staticcheck is a go vet on steroids, applying a ton of static analysis checks
- staticcheck
# Stylecheck is a replacement for golint
- stylecheck
# linter that makes you use a separate _test package
# - testpackage
# Like the front-end of a Go compiler, parses and type-checks Go code
- typecheck
# Remove unnecessary type conversions
- unconvert
# (?) Reports unused function parameters
# - unparam
# Checks Go code for unused constants, variables, functions and types
- unused
# Tool for detection of leading and trailing whitespace
- whitespace
# Whitespace Linter - Forces you to use empty lines!
# - wsl
run:
skip-dirs:
- vendor
issues:
exclude-rules:
- linters:
- lll
source: "^//go:generate "
# golangci.com configuration
# https://github.com/golangci/golangci-lint-action?tab=readme-ov-file#how-to-use
service:
golangci-lint-version: 1.59.x # use the fixed version to not introduce new linters unexpectedly