Skip to content

Commit 71494a8

Browse files
author
Evsyukov Denis
committed
fix: update golangci-lint version and adjust linter settings
1 parent 107b8a8 commit 71494a8

File tree

2 files changed

+76
-74
lines changed

2 files changed

+76
-74
lines changed

.github/workflows/lint.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jobs:
3636
3737
- name: Run golangci-lint
3838
run: |
39-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b . v1.60.1
40-
./golangci-lint run --sort-results --build-tags integration,test
39+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b . v2.1.6
40+
./golangci-lint run --build-tags integration,test
4141
4242
4343
codespell:

.golangci.yaml

Lines changed: 74 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
run:
2-
timeout: 15m
1+
version: "2"
32
linters:
4-
disable-all: true
3+
default: none
54
enable:
65
- asciicheck
76
- bodyclose
7+
- copyloopvar
88
- depguard
99
- dogsled
1010
- durationcheck
11-
- copyloopvar
12-
- gci
1311
- gochecknoinits
1412
- gocritic
15-
- gofmt
16-
- gofumpt
1713
- goprintffuncname
18-
- gosimple
1914
- govet
2015
- ineffassign
2116
- misspell
@@ -25,89 +20,96 @@ linters:
2520
- revive
2621
- sloglint
2722
- staticcheck
28-
- stylecheck
2923
- unconvert
3024
- unused
3125
- whitespace
32-
linters-settings:
33-
gci:
34-
sections:
35-
- standard
36-
- default
37-
- prefix(github.com/flant/)
38-
goimports:
39-
local-prefixes: github.com/flant/
40-
nolintlint:
41-
allow-unused: true
42-
sloglint:
43-
# Enforce not mixing key-value pairs and attributes.
26+
settings:
27+
depguard:
28+
rules:
29+
Main:
30+
files:
31+
- $all
32+
deny:
33+
- pkg: gopkg.in/satori/go.uuid.v1
34+
desc: Use https://github.com/gofrs/uuid instead. Satori/go.uuid is no longer maintained and has critical vulnerabilities.
35+
nolintlint:
36+
allow-unused: true
37+
nonamedreturns:
38+
report-error-in-defer: false
39+
sloglint:
4440
no-mixed-args: true
45-
# Enforce using key-value pairs only (overrides no-mixed-args, incompatible with attr-only).
4641
kv-only: false
47-
# Enforce using attributes only (overrides no-mixed-args, incompatible with kv-only).
4842
attr-only: false
49-
# Enforce not using global loggers.
5043
no-global: ""
51-
# Enforce using methods that accept a context.
5244
context: ""
53-
# Enforce using static values for log messages.
5445
static-msg: false
55-
# Enforce using constants instead of raw keys.
5646
no-raw-keys: false
57-
# Enforce a single key naming convention.
58-
key-naming-case: ""
59-
# Enforce not using specific keys.
6047
forbidden-keys:
6148
- level
6249
- msg
6350
- logger
6451
- source
6552
- stacktrace
6653
- time
67-
# Enforce putting arguments on separate lines.
6854
args-on-sep-lines: false
69-
depguard:
55+
exclusions:
56+
generated: lax
57+
presets:
58+
- comments
59+
- common-false-positives
60+
- legacy
61+
- std-error-handling
7062
rules:
71-
Main:
72-
files:
73-
- $all
74-
deny:
75-
- pkg: "gopkg.in/satori/go.uuid.v1"
76-
desc: "Use https://github.com/gofrs/uuid instead. Satori/go.uuid is no longer maintained and has critical vulnerabilities."
77-
nonamedreturns:
78-
# Report named error if it is assigned inside defer.
79-
# Default: false
80-
report-error-in-defer: false
63+
- path: (.+)\.go$
64+
text: 'var-naming: don''t use an underscore in package name'
65+
- path: (.+)\.go$
66+
text: 'ST1003: should not use underscores in package names'
67+
- path: (.+)\.go$
68+
text: 'ST1005: error strings should not be capitalized'
69+
- path: (.+)\.go$
70+
text: 'error-strings: error strings should not be capitalized or end with punctuation or a newline'
71+
- path: (.+)\.go$
72+
text: 'ST1005: error strings should not end with punctuation or newlines'
73+
- path: (.+)\.go$
74+
text: 'dot-imports: should not use dot imports'
75+
- path: (.+)\.go$
76+
text: 'ST1001: should not use dot imports'
77+
- path: (.+)\.go$
78+
text: don't use `init` function
79+
- path: (.+)\.go$
80+
text: 'var-naming:'
81+
- path: (.+)\.go$
82+
text: 'ST1003: '
83+
- path: (.+)\.go$
84+
text: 'exported: type name will be used as'
85+
- path: (.+)\.go$
86+
text: 'unexported-return: exported func (.*), which can be annoying to use'
87+
paths:
88+
- test/integration
89+
- third_party$
90+
- builtin$
91+
- examples$
8192
issues:
82-
exclude-dirs:
83-
- test/integration
84-
exclude:
85-
# Using underscores is a common practice, refactor in the future
86-
- "var-naming: don't use an underscore in package name" # revive
87-
- "ST1003: should not use underscores in package names" # stylecheck
88-
89-
# Sometime errors are used to propagate messages for end-users
90-
- "ST1005: error strings should not be capitalized" # stylecheck
91-
- "error-strings: error strings should not be capitalized or end with punctuation or a newline" # revive
92-
- "ST1005: error strings should not end with punctuation or newlines" # stylecheck
93-
94-
# Dot imports are used for types, consider refactoring
95-
- "dot-imports: should not use dot imports" # revive
96-
- "ST1001: should not use dot imports" # stylecheck
97-
98-
# Init functions are used for global variables' initialization, consider refactoring
99-
- "don't use `init` function"
100-
101-
# Suggests changing Json -> JSON. Figure out which style we want to follow.
102-
- "var-naming:" # revive
103-
- "ST1003: " # stylecheck
104-
105-
# Exported name should not start with the package name, e.g., helm3.Helm3Options.
106-
# However, this penetrates all the code and sometimes is used to avoid name collisions.
107-
# Nice to refactor, but not necessary.
108-
- "exported: type name will be used as" # revive
109-
110-
# It is annoying be design, consider refactoring
111-
- "unexported-return: exported func (.*), which can be annoying to use" # revive
11293
max-issues-per-linter: 0
11394
max-same-issues: 0
95+
formatters:
96+
enable:
97+
- gci
98+
- gofmt
99+
- gofumpt
100+
settings:
101+
gci:
102+
sections:
103+
- standard
104+
- default
105+
- prefix(github.com/flant/)
106+
goimports:
107+
local-prefixes:
108+
- github.com/flant/
109+
exclusions:
110+
generated: lax
111+
paths:
112+
- test/integration
113+
- third_party$
114+
- builtin$
115+
- examples$

0 commit comments

Comments
 (0)