Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0441aa9

Browse files
committed
Migrated golanci.yml to v2
1 parent 52e59ad commit 0441aa9

File tree

1 file changed

+152
-157
lines changed

1 file changed

+152
-157
lines changed

‎.golangci.yml‎

Lines changed: 152 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -1,185 +1,180 @@
1+
version: "2"
12
run:
2-
timeout: 10m
33
go: "1.24"
44
tests: true
55

66
linters:
77
# Disable all linters.
8-
disable-all: true
8+
default: none
99
# Enable specific linter
1010
enable:
1111
# Nice to have
1212
#- depguard
1313
#- errcheck
1414
#- gocritic
1515
#- thelper
16-
- errorlint
17-
- dupword
1816
- copyloopvar
17+
- dupword
18+
- errorlint
1919
- forbidigo
20-
- gofmt
21-
- goimports
2220
- gosec
23-
- gosimple
2421
- govet
2522
- ineffassign
2623
- misspell
2724
- revive
2825
- staticcheck
29-
- tenv
30-
- typecheck
3126
- unconvert
3227
# We must disable this one because there is no support 'optional' protobuf fields yet: https://github.com/arduino/arduino-cli/pull/2570
3328
#- protogetter
3429

35-
linters-settings:
36-
govet:
37-
# Enable analyzers by name.
38-
# Run `GL_DEBUG=govet golangci-lint run --enable=govet` to see default, all available analyzers, and enabled analyzers.
39-
enable:
40-
- appends
41-
- asmdecl
42-
- assign
43-
- atomic
44-
- atomicalign
45-
- bools
46-
- buildtag
47-
- cgocall
48-
- composites
49-
- copylocks
50-
- deepequalerrors
51-
- defers
52-
- directive
53-
- errorsas
54-
#- fieldalignment
55-
- findcall
56-
- framepointer
57-
- httpresponse
58-
- ifaceassert
59-
- loopclosure
60-
- lostcancel
61-
- nilfunc
62-
- nilness
63-
- printf
64-
- reflectvaluecompare
65-
#- shadow
66-
- shift
67-
- sigchanyzer
68-
- slog
69-
- sortslice
70-
- stdmethods
71-
- stringintconv
72-
- structtag
73-
- testinggoroutine
74-
- tests
75-
- unmarshal
76-
- unreachable
77-
- unsafeptr
78-
- unusedresult
79-
- unusedwrite
80-
81-
forbidigo:
82-
forbid:
83-
- p: ^(fmt\.Print(|f|ln)|print|println)$
84-
msg: in cli package use `feedback.*` instead
85-
- p: (os\.(Stdout|Stderr|Stdin))(# )?
86-
msg: in cli package use `feedback.*` instead
87-
analyze-types: true
88-
89-
revive:
90-
confidence: 0.8
30+
settings:
31+
errorlint:
32+
errorf: false
33+
asserts: false
34+
comparison: true
35+
forbidigo:
36+
forbid:
37+
- pattern: ^(fmt\.Print(|f|ln)|print|println)$
38+
msg: in cli package use `feedback.*` instead
39+
- pattern: (os\.(Stdout|Stderr|Stdin))(# )?
40+
msg: in cli package use `feedback.*` instead
41+
analyze-types: true
42+
govet:
43+
enable:
44+
- appends
45+
- asmdecl
46+
- assign
47+
- atomic
48+
- atomicalign
49+
- bools
50+
- buildtag
51+
- cgocall
52+
- composites
53+
- copylocks
54+
- deepequalerrors
55+
- defers
56+
- directive
57+
- errorsas
58+
- findcall
59+
- framepointer
60+
- httpresponse
61+
- ifaceassert
62+
- loopclosure
63+
- lostcancel
64+
- nilfunc
65+
- nilness
66+
- printf
67+
- reflectvaluecompare
68+
- shift
69+
- sigchanyzer
70+
- slog
71+
- sortslice
72+
- stdmethods
73+
- stringintconv
74+
- structtag
75+
- testinggoroutine
76+
- tests
77+
- unmarshal
78+
- unreachable
79+
- unsafeptr
80+
- unusedresult
81+
- unusedwrite
82+
revive:
83+
confidence: 0.8
84+
rules:
85+
- name: blank-imports
86+
- name: context-as-argument
87+
- name: context-keys-type
88+
- name: dot-imports
89+
- name: empty-block
90+
- name: error-naming
91+
- name: error-strings
92+
- name: errorf
93+
- name: exported
94+
- name: increment-decrement
95+
- name: package-comments
96+
- name: range
97+
- name: receiver-naming
98+
- name: redefines-builtin-id
99+
- name: superfluous-else
100+
- name: time-naming
101+
- name: unreachable-code
102+
- name: var-declaration
103+
- name: defer
104+
- name: atomic
105+
- name: waitgroup-by-value
106+
exclusions:
107+
generated: lax
108+
presets:
109+
- comments
110+
- common-false-positives
111+
- legacy
112+
- std-error-handling
91113
rules:
92-
#- name: error-return
93-
#- name: unused-parameter
94-
#- name: var-naming
95-
- name: blank-imports
96-
- name: context-as-argument
97-
- name: context-keys-type
98-
- name: dot-imports
99-
- name: empty-block
100-
- name: error-naming
101-
- name: error-strings
102-
- name: errorf
103-
- name: exported
104-
- name: increment-decrement
105-
#- name: indent-error-flow
106-
- name: package-comments
107-
- name: range
108-
- name: receiver-naming
109-
- name: redefines-builtin-id
110-
- name: superfluous-else
111-
- name: time-naming
112-
- name: unreachable-code
113-
- name: var-declaration
114-
- name: defer
115-
- name: atomic
116-
- name: waitgroup-by-value
117-
118-
errorlint:
119-
# Check for plain error comparisons.
120-
comparison: true
121-
122-
# We might evalute to allow the asserts and errofs in the future
123-
# Do not check for plain type assertions and type switches.
124-
asserts: false
125-
# Do not check whether fmt.Errorf uses the %w verb for formatting errors.
126-
errorf: false
127-
114+
- linters:
115+
- errcheck
116+
- gosec
117+
path: _test\.go
118+
- linters:
119+
- gosec
120+
text: G401
121+
- linters:
122+
- gosec
123+
text: G501
124+
- linters:
125+
- gosec
126+
path: internal/integrationtest/
127+
text: G112
128+
- linters:
129+
- gosec
130+
path: executils/process.go
131+
text: G204
132+
- linters:
133+
- staticcheck
134+
path: commands/lib/search.go
135+
text: SA1019
136+
- linters:
137+
- revive
138+
path: arduino/libraries/loader.go
139+
text: empty-block
140+
- linters:
141+
- revive
142+
path: arduino/serialutils/serialutils.go
143+
text: empty-block
144+
- linters:
145+
- revive
146+
path: arduino/resources/download.go
147+
text: empty-block
148+
- linters:
149+
- revive
150+
path: arduino/builder/internal/progress/progress_test.go
151+
text: empty-block
152+
- linters:
153+
- revive
154+
path: internal/algorithms/channels.go
155+
text: empty-block
156+
- linters:
157+
- forbidigo
158+
path-except: internal/cli/
159+
- linters:
160+
- forbidigo
161+
path: internal/cli/.*_test.go
162+
- linters:
163+
- forbidigo
164+
path: internal/cli/feedback/
165+
paths:
166+
- third_party$
167+
- builtin$
168+
- examples$
128169
issues:
129-
# Fix found issues (if it's supported by the linter).
130170
fix: false
131-
# List of regexps of issue texts to exclude.
132-
#
133-
# But independently of this option we use default exclude patterns,
134-
# it can be disabled by `exclude-use-default: false`.
135-
# To list all excluded by default patterns execute `golangci-lint run --help`
136-
#
137-
# Default: https://golangci-lint.run/usage/false-positives/#default-exclusions
138-
exclude-rules:
139-
# Exclude some linters from running on tests files.
140-
- path: _test\.go
141-
linters: [gosec, errcheck]
142-
# G401: Use of weak cryptographic primitive
143-
- linters: [gosec]
144-
text: "G401"
145-
# G501: Blocklisted import crypto/md5: weak cryptographic primitive
146-
- linters: [gosec]
147-
text: "G501"
148-
# G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server
149-
- linters: [gosec]
150-
path: internal/integrationtest/
151-
text: "G112"
152-
# G204: Subprocess launched with a potential tainted input or cmd arguments
153-
- linters: [gosec]
154-
path: executils/process.go
155-
text: "G204"
156-
# SA1019: req.GetQuery is deprecated: Marked as deprecated in cc/arduino/cli/commands/v1/lib.proto.
157-
- linters: [staticcheck]
158-
path: commands/lib/search.go
159-
text: "SA1019"
160-
161-
# Ignore revive emptyblock
162-
- linters: [revive]
163-
path: arduino/libraries/loader.go
164-
text: "empty-block"
165-
- linters: [revive]
166-
path: arduino/serialutils/serialutils.go
167-
text: "empty-block"
168-
- linters: [revive]
169-
path: arduino/resources/download.go
170-
text: "empty-block"
171-
- linters: [revive]
172-
path: arduino/builder/internal/progress/progress_test.go
173-
text: "empty-block"
174-
- linters: [revive]
175-
path: internal/algorithms/channels.go
176-
text: "empty-block"
177-
178-
# Run linters only on specific path
179-
- path-except: internal/cli/
180-
linters:
181-
- forbidigo
182-
- path: internal/cli/.*_test.go
183-
linters: [forbidigo]
184-
- path: internal/cli/feedback/
185-
linters: [forbidigo]
171+
formatters:
172+
enable:
173+
- gofmt
174+
- goimports
175+
exclusions:
176+
generated: lax
177+
paths:
178+
- third_party$
179+
- builtin$
180+
- examples$

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /