knative.dev/pkg@v0.0.0-20260602142205-ac97e43f6622/.golangci.yaml (about) 1 version: "2" 2 3 run: 4 allow-parallel-runners: true 5 output: 6 sort-order: 7 - linter 8 - file 9 10 issues: 11 max-issues-per-linter: 0 12 max-same-issues: 0 13 uniq-by-line: true 14 formatters: 15 enable: 16 - gofmt 17 - gofumpt 18 - goimports 19 exclusions: 20 generated: lax 21 paths: 22 - client 23 - injection/clients 24 - third_party$ 25 - builtin$ 26 - examples$ 27 28 linters: 29 enable: 30 # Check for pass []any as any in variadic func(...any). 31 - asasalint 32 33 # Only use ASCII chars in indentifiers 34 - asciicheck 35 36 # Dangerous unicode characters 37 - bidichk 38 39 # Checks whether HTTP response body is closed successfully. 40 - bodyclose 41 42 # Canonicalheader checks whether net/http.Header uses canonical header. 43 - canonicalheader 44 45 # Copyloopvar is a linter detects places where loop variables are copied. 46 - copyloopvar 47 48 # Check declaration order of types, consts, vars and funcs. 49 - decorder 50 51 # Check for two durations multiplied together. 52 - durationcheck 53 54 # Checks that sentinel errors are prefixed with the Err- and error types 55 # are suffixed with the -Error. 56 - errname 57 58 # Errorlint is a linter for that can be used to find code that will cause 59 # problems with the error wrapping scheme introduced in Go 1.13. 60 - errorlint 61 62 # Detects nested contexts in loops. 63 - fatcontext 64 65 # Checks that go compiler directive comments (//go:) are valid. 66 - gocheckcompilerdirectives 67 68 # Provides diagnostics that check for bugs, performance and style issues. 69 # Extensible without recompilation through dynamic rules. 70 # Dynamic rules are written declaratively with AST patterns, filters, 71 # report message and optional suggestion. 72 - gocritic 73 74 # See config below 75 - gomodguard 76 77 # Inspects source code for security problems. 78 - gosec 79 80 # Intrange is a linter to find places where for loops could make use of 81 # an integer range. 82 - intrange 83 84 # Checks key value pairs for common logger libraries (kitlog,klog,logr,zap). 85 - loggercheck 86 87 # Finds slice declarations with non-zero initial length. 88 - makezero 89 90 # Reports wrong mirror patterns of bytes/strings usage 91 - mirror 92 93 # Finds commonly misspelled English words. 94 - misspell 95 96 # Finds the code that returns nil even if it checks that the error is not nil. 97 - nilerr 98 99 # Finds sending HTTP request without context.Context. 100 - noctx 101 102 # Reports ill-formed or insufficient nolint directives. 103 - nolintlint 104 105 # Checks for misuse of Sprintf to construct a host with port in a URL. 106 - nosprintfhostport 107 108 # Checks that fmt.Sprintf can be replaced with a faster alternative. 109 - perfsprint 110 111 # Finds slice declarations that could potentially be pre-allocated. 112 - prealloc 113 114 # Reports direct reads from proto message fields when getters should be used. 115 - protogetter 116 117 # Checks that package variables are not reassigned. 118 - reassign 119 120 # Fast, configurable, extensible, flexible, and beautiful linter for 121 # Go. Drop-in replacement of golint. 122 - revive 123 124 # Checks for mistakes with OpenTelemetry/Census spans. 125 - spancheck 126 127 # Stylecheck is a replacement for golint. 128 - staticcheck 129 130 # Linter checks if examples are testable (have an expected output). 131 - testableexamples 132 133 # Remove unnecessary type conversions. 134 - unconvert 135 136 # Reports unused function parameters and results in your code. 137 - unparam 138 139 # A linter that detect the possibility to use variables/constants from the 140 # Go standard library. 141 - usestdlibvars 142 143 # Finds wasted assignment statements. 144 - wastedassign 145 146 # Whitespace is a linter that checks for unnecessary newlines at the start 147 # and end of functions, if, for, etc. 148 - whitespace 149 150 disable: 151 - errcheck 152 settings: 153 staticcheck: 154 checks: 155 - all 156 - "-QF1008" # Disable https://staticcheck.dev/docs/checks/#QF1008 157 gomodguard: 158 blocked: 159 modules: 160 - github.com/ghodss/yaml: 161 recommendations: 162 - sigs.k8s.io/yaml 163 - go.uber.org/atomic: 164 recommendations: 165 - sync/atomic 166 - io/ioutil: 167 recommendations: 168 - os 169 - io 170 - github.com/hashicorp/go-multierror: 171 recommendations: 172 - errors 173 reason: use errors.Join 174 - go.uber.org/multierr: 175 recommendations: 176 - errors 177 reason: use errors.Join 178 revive: 179 rules: 180 # use unparam linter instead - defaults are better 181 - name: unused-parameter 182 disabled: true 183 exclusions: 184 generated: lax 185 presets: 186 - comments 187 - common-false-positives 188 - legacy 189 - std-error-handling 190 rules: 191 - linters: 192 - staticcheck 193 text: corev1.Endpoint.* is deprecated 194 - linters: 195 - staticcheck 196 text: .*NewSimpleClientset is deprecated 197 - linters: 198 - gosec 199 - noctx 200 - protogetter 201 - unparam 202 path: test 203 - linters: 204 - gocritic 205 text: ifElseChain 206 paths: 207 - client 208 - injection/clients 209 - third_party$ 210 - builtin$ 211 - examples$