Skip to content

Commit 1557d31

Browse files
pionbotJoeTurki
authored andcommitted
Update CI configs to v0.11.22
Update lint scripts and CI configs.
1 parent 22cf05c commit 1557d31

File tree

1 file changed

+72
-74
lines changed

1 file changed

+72
-74
lines changed

.golangci.yml

Lines changed: 72 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,7 @@
11
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
22
# SPDX-License-Identifier: MIT
33

4-
run:
5-
timeout: 5m
6-
7-
linters-settings:
8-
govet:
9-
enable:
10-
- shadow
11-
misspell:
12-
locale: US
13-
exhaustive:
14-
default-signifies-exhaustive: true
15-
gomodguard:
16-
blocked:
17-
modules:
18-
- github.com/pkg/errors:
19-
recommendations:
20-
- errors
21-
forbidigo:
22-
analyze-types: true
23-
forbid:
24-
- ^fmt.Print(f|ln)?$
25-
- ^log.(Panic|Fatal|Print)(f|ln)?$
26-
- ^os.Exit$
27-
- ^panic$
28-
- ^print(ln)?$
29-
- p: ^testing.T.(Error|Errorf|Fatal|Fatalf|Fail|FailNow)$
30-
pkg: ^testing$
31-
msg: "use testify/assert instead"
32-
varnamelen:
33-
max-distance: 12
34-
min-name-length: 2
35-
ignore-type-assert-ok: true
36-
ignore-map-index-ok: true
37-
ignore-chan-recv-ok: true
38-
ignore-decls:
39-
- i int
40-
- n int
41-
- w io.Writer
42-
- r io.Reader
43-
- b []byte
44-
revive:
45-
rules:
46-
# Prefer 'any' type alias over 'interface{}' for Go 1.18+ compatibility
47-
- name: use-any
48-
severity: warning
49-
disabled: false
50-
4+
version: "2"
515
linters:
526
enable:
537
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
@@ -66,25 +20,19 @@ linters:
6620
- errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`.
6721
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
6822
- exhaustive # check exhaustiveness of enum switch statements
69-
- exportloopref # checks for pointers to enclosing loop variables
7023
- forbidigo # Forbids identifiers
7124
- forcetypeassert # finds forced type assertions
72-
- gci # Gci control golang package import order and make it always deterministic.
7325
- gochecknoglobals # Checks that no globals are present in Go code
7426
- gocognit # Computes and checks the cognitive complexity of functions
7527
- goconst # Finds repeated strings that could be replaced by a constant
7628
- gocritic # The most opinionated Go source code linter
7729
- gocyclo # Computes and checks the cyclomatic complexity of functions
7830
- godot # Check if comments end in a period
7931
- godox # Tool for detection of FIXME, TODO and other comment keywords
80-
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
81-
- gofumpt # Gofumpt checks whether code was gofumpt-ed.
8232
- goheader # Checks is file header matches to pattern
83-
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports
8433
- gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.
8534
- goprintffuncname # Checks that printf-like functions are named with `f` at the end
8635
- gosec # Inspects source code for security problems
87-
- gosimple # Linter for Go source code that specializes in simplifying a code
8836
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
8937
- grouper # An analyzer to analyze expression groups.
9038
- importas # Enforces consistent import aliases
@@ -102,11 +50,8 @@ linters:
10250
- predeclared # find code that shadows one of Go's predeclared identifiers
10351
- revive # golint replacement, finds style mistakes
10452
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
105-
- stylecheck # Stylecheck is a replacement for golint
10653
- tagliatelle # Checks the struct tags.
107-
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
10854
- thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers
109-
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
11055
- unconvert # Remove unnecessary type conversions
11156
- unparam # Reports unused function parameters
11257
- unused # Checks Go code for unused constants, variables, functions and types
@@ -131,21 +76,74 @@ linters:
13176
- tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes
13277
- wrapcheck # Checks that errors returned from external packages are wrapped
13378
- wsl # Whitespace Linter - Forces you to use empty lines!
134-
135-
issues:
136-
exclude-use-default: false
137-
exclude-dirs-use-default: false
138-
exclude-rules:
139-
# Allow complex tests and examples, better to be self contained
140-
- path: (examples|main\.go)
141-
linters:
142-
- gocognit
143-
- forbidigo
144-
- path: _test\.go
145-
linters:
146-
- gocognit
147-
148-
# Allow forbidden identifiers in CLI commands
149-
- path: cmd
150-
linters:
151-
- forbidigo
79+
settings:
80+
staticcheck:
81+
checks:
82+
- all
83+
# "could remove embedded field", to keep it explicit!
84+
- -QF1008
85+
# "could use tagged switch on enum", Cases conflicts with exhaustive!
86+
- -QF1003
87+
exhaustive:
88+
default-signifies-exhaustive: true
89+
forbidigo:
90+
forbid:
91+
- pattern: ^fmt.Print(f|ln)?$
92+
- pattern: ^log.(Panic|Fatal|Print)(f|ln)?$
93+
- pattern: ^os.Exit$
94+
- pattern: ^panic$
95+
- pattern: ^print(ln)?$
96+
- pattern: ^testing.T.(Error|Errorf|Fatal|Fatalf|Fail|FailNow)$
97+
pkg: ^testing$
98+
msg: use testify/assert instead
99+
analyze-types: true
100+
gomodguard:
101+
blocked:
102+
modules:
103+
- github.com/pkg/errors:
104+
recommendations:
105+
- errors
106+
govet:
107+
enable:
108+
- shadow
109+
revive:
110+
rules:
111+
# Prefer 'any' type alias over 'interface{}' for Go 1.18+ compatibility
112+
- name: use-any
113+
severity: warning
114+
disabled: false
115+
misspell:
116+
locale: US
117+
varnamelen:
118+
max-distance: 12
119+
min-name-length: 2
120+
ignore-type-assert-ok: true
121+
ignore-map-index-ok: true
122+
ignore-chan-recv-ok: true
123+
ignore-decls:
124+
- i int
125+
- n int
126+
- w io.Writer
127+
- r io.Reader
128+
- b []byte
129+
exclusions:
130+
generated: lax
131+
rules:
132+
- linters:
133+
- forbidigo
134+
- gocognit
135+
path: (examples|main\.go)
136+
- linters:
137+
- gocognit
138+
path: _test\.go
139+
- linters:
140+
- forbidigo
141+
path: cmd
142+
formatters:
143+
enable:
144+
- gci
145+
- gofmt
146+
- gofumpt
147+
- goimports
148+
exclusions:
149+
generated: lax

0 commit comments

Comments
 (0)