1
1
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
2
2
# SPDX-License-Identifier: MIT
3
3
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"
51
5
linters :
52
6
enable :
53
7
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
@@ -66,25 +20,19 @@ linters:
66
20
- errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`.
67
21
- 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.
68
22
- exhaustive # check exhaustiveness of enum switch statements
69
- - exportloopref # checks for pointers to enclosing loop variables
70
23
- forbidigo # Forbids identifiers
71
24
- forcetypeassert # finds forced type assertions
72
- - gci # Gci control golang package import order and make it always deterministic.
73
25
- gochecknoglobals # Checks that no globals are present in Go code
74
26
- gocognit # Computes and checks the cognitive complexity of functions
75
27
- goconst # Finds repeated strings that could be replaced by a constant
76
28
- gocritic # The most opinionated Go source code linter
77
29
- gocyclo # Computes and checks the cyclomatic complexity of functions
78
30
- godot # Check if comments end in a period
79
31
- 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.
82
32
- goheader # Checks is file header matches to pattern
83
- - goimports # Goimports does everything that gofmt does. Additionally it checks unused imports
84
33
- gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.
85
34
- goprintffuncname # Checks that printf-like functions are named with `f` at the end
86
35
- gosec # Inspects source code for security problems
87
- - gosimple # Linter for Go source code that specializes in simplifying a code
88
36
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
89
37
- grouper # An analyzer to analyze expression groups.
90
38
- importas # Enforces consistent import aliases
@@ -102,11 +50,8 @@ linters:
102
50
- predeclared # find code that shadows one of Go's predeclared identifiers
103
51
- revive # golint replacement, finds style mistakes
104
52
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
105
- - stylecheck # Stylecheck is a replacement for golint
106
53
- tagliatelle # Checks the struct tags.
107
- - tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
108
54
- 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
110
55
- unconvert # Remove unnecessary type conversions
111
56
- unparam # Reports unused function parameters
112
57
- unused # Checks Go code for unused constants, variables, functions and types
@@ -131,21 +76,74 @@ linters:
131
76
- tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes
132
77
- wrapcheck # Checks that errors returned from external packages are wrapped
133
78
- 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