.golangci.yml (9466B)
1 # See https://github.com/golangci/golangci-lint#config-file 2 run: 3 issues-exit-code: 1 #Default 4 tests: true #Default 5 6 linters: 7 # Disable everything by default so upgrades to not include new "default 8 # enabled" linters. 9 disable-all: true 10 # Specifically enable linters we want to use. 11 enable: 12 - depguard 13 - errcheck 14 - godot 15 - gofmt 16 - goimports 17 - gosimple 18 - govet 19 - ineffassign 20 - misspell 21 - revive 22 - staticcheck 23 - typecheck 24 - unused 25 26 issues: 27 # Maximum issues count per one linter. 28 # Set to 0 to disable. 29 # Default: 50 30 # Setting to unlimited so the linter only is run once to debug all issues. 31 max-issues-per-linter: 0 32 # Maximum count of issues with the same text. 33 # Set to 0 to disable. 34 # Default: 3 35 # Setting to unlimited so the linter only is run once to debug all issues. 36 max-same-issues: 0 37 # Excluding configuration per-path, per-linter, per-text and per-source. 38 exclude-rules: 39 # TODO: Having appropriate comments for exported objects helps development, 40 # even for objects in internal packages. Appropriate comments for all 41 # exported objects should be added and this exclusion removed. 42 - path: '.*internal/.*' 43 text: "exported (method|function|type|const) (.+) should have comment or be unexported" 44 linters: 45 - revive 46 # Yes, they are, but it's okay in a test. 47 - path: _test\.go 48 text: "exported func.*returns unexported type.*which can be annoying to use" 49 linters: 50 - revive 51 # Example test functions should be treated like main. 52 - path: example.*_test\.go 53 text: "calls to (.+) only in main[(][)] or init[(][)] functions" 54 linters: 55 - revive 56 include: 57 # revive exported should have comment or be unexported. 58 - EXC0012 59 # revive package comment should be of the form ... 60 - EXC0013 61 62 linters-settings: 63 depguard: 64 # Check the list against standard lib. 65 # Default: false 66 include-go-root: true 67 # A list of packages for the list type specified. 68 # Default: [] 69 packages: 70 - "crypto/md5" 71 - "crypto/sha1" 72 - "crypto/**/pkix" 73 ignore-file-rules: 74 - "**/*_test.go" 75 additional-guards: 76 # Do not allow testing packages in non-test files. 77 - list-type: denylist 78 include-go-root: true 79 packages: 80 - testing 81 - github.com/stretchr/testify 82 ignore-file-rules: 83 - "**/*_test.go" 84 - "**/*test/*.go" 85 - "**/internal/matchers/*.go" 86 godot: 87 exclude: 88 # Exclude links. 89 - '^ *\[[^]]+\]:' 90 # Exclude sentence fragments for lists. 91 - '^[ ]*[-•]' 92 # Exclude sentences prefixing a list. 93 - ':$' 94 goimports: 95 local-prefixes: go.opentelemetry.io 96 misspell: 97 locale: US 98 ignore-words: 99 - cancelled 100 revive: 101 # Sets the default failure confidence. 102 # This means that linting errors with less than 0.8 confidence will be ignored. 103 # Default: 0.8 104 confidence: 0.01 105 rules: 106 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#blank-imports 107 - name: blank-imports 108 disabled: false 109 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr 110 - name: bool-literal-in-expr 111 disabled: false 112 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#constant-logical-expr 113 - name: constant-logical-expr 114 disabled: false 115 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument 116 # TODO (#3372) re-enable linter when it is compatible. https://github.com/golangci/golangci-lint/issues/3280 117 - name: context-as-argument 118 disabled: true 119 arguments: 120 allowTypesBefore: "*testing.T" 121 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-keys-type 122 - name: context-keys-type 123 disabled: false 124 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#deep-exit 125 - name: deep-exit 126 disabled: false 127 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#defer 128 - name: defer 129 disabled: false 130 arguments: 131 - ["call-chain", "loop"] 132 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#dot-imports 133 - name: dot-imports 134 disabled: false 135 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#duplicated-imports 136 - name: duplicated-imports 137 disabled: false 138 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return 139 - name: early-return 140 disabled: false 141 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-block 142 - name: empty-block 143 disabled: false 144 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines 145 - name: empty-lines 146 disabled: false 147 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-naming 148 - name: error-naming 149 disabled: false 150 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-return 151 - name: error-return 152 disabled: false 153 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-strings 154 - name: error-strings 155 disabled: false 156 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#errorf 157 - name: errorf 158 disabled: false 159 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#exported 160 - name: exported 161 disabled: false 162 arguments: 163 - "sayRepetitiveInsteadOfStutters" 164 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#flag-parameter 165 - name: flag-parameter 166 disabled: false 167 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#identical-branches 168 - name: identical-branches 169 disabled: false 170 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#if-return 171 - name: if-return 172 disabled: false 173 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#increment-decrement 174 - name: increment-decrement 175 disabled: false 176 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#indent-error-flow 177 - name: indent-error-flow 178 disabled: false 179 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#import-shadowing 180 - name: import-shadowing 181 disabled: false 182 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#package-comments 183 - name: package-comments 184 disabled: false 185 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range 186 - name: range 187 disabled: false 188 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range-val-in-closure 189 - name: range-val-in-closure 190 disabled: false 191 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range-val-address 192 - name: range-val-address 193 disabled: false 194 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#redefines-builtin-id 195 - name: redefines-builtin-id 196 disabled: false 197 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format 198 - name: string-format 199 disabled: false 200 arguments: 201 - - panic 202 - '/^[^\n]*$/' 203 - must not contain line breaks 204 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag 205 - name: struct-tag 206 disabled: false 207 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#superfluous-else 208 - name: superfluous-else 209 disabled: false 210 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#time-equal 211 - name: time-equal 212 disabled: false 213 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-naming 214 - name: var-naming 215 disabled: false 216 arguments: 217 - ["ID"] # AllowList 218 - ["Otel", "Aws", "Gcp"] # DenyList 219 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-declaration 220 - name: var-declaration 221 disabled: false 222 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unconditional-recursion 223 - name: unconditional-recursion 224 disabled: false 225 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-return 226 - name: unexported-return 227 disabled: false 228 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error 229 - name: unhandled-error 230 disabled: false 231 arguments: 232 - "fmt.Fprint" 233 - "fmt.Fprintf" 234 - "fmt.Fprintln" 235 - "fmt.Print" 236 - "fmt.Printf" 237 - "fmt.Println" 238 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unnecessary-stmt 239 - name: unnecessary-stmt 240 disabled: false 241 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break 242 - name: useless-break 243 disabled: false 244 # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#waitgroup-by-value 245 - name: waitgroup-by-value 246 disabled: false