|
| 1 | +# See https://golangci-lint.run/usage/configuration/ |
| 2 | + |
| 3 | +linters: |
| 4 | + disable-all: true |
| 5 | + enable: |
| 6 | + # See https://golangci-lint.run/usage/linters/ |
| 7 | + - asasalint # Check for pass []any as any in variadic func(...any). |
| 8 | + - bodyclose # Checks whether HTTP response body is closed successfully. |
| 9 | + - contextcheck # Check whether the function uses a non-inherited context. |
| 10 | + - durationcheck # Check for two durations multiplied together. |
| 11 | + - errcheck # Checks whether Rows.Err of rows is checked successfully. |
| 12 | + - errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and reports occations, where the check for the returned error can be omitted. |
| 13 | + - 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. |
| 14 | + - forbidigo # Forbids identifiers. |
| 15 | + - gci # Gci controls Go package import order and makes it always deterministic. |
| 16 | + - gocritic # Provides diagnostics that check for bugs, performance and style issues. Extensible without recompilation through dynamic rules. Dynamic rules are written declaratively with AST patterns, filters, report message and optional suggestion. |
| 17 | + - godot # Check if comments end in a period. |
| 18 | + - gosec # Inspects source code for security problems. |
| 19 | + - gosimple # Linter for Go source code that specializes in simplifying code. |
| 20 | + - govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string. |
| 21 | + - inamedparam # Reports interfaces with unnamed method parameters. |
| 22 | + - ineffassign # Detects when assignments to existing variables are not used. |
| 23 | + - mirror # Reports wrong mirror patterns of bytes/strings usage. |
| 24 | + - misspell # Finds commonly misspelled English words. |
| 25 | + - musttag # Enforce field tags in (un)marshaled structs. |
| 26 | + - nilerr # Finds the code that returns nil even if it checks that the error is not nil. |
| 27 | + - nilnil # Checks that there is no simultaneous return of nil error and an invalid value. |
| 28 | + - noctx # Finds sending http request without context.Context. |
| 29 | + - nolintlint # Reports ill-formed or insufficient nolint directives. |
| 30 | + - nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL. |
| 31 | + - perfsprint # Checks that fmt.Sprintf can be replaced with a faster alternative. |
| 32 | + - protogetter # Reports direct reads from proto message fields when getters should be used. |
| 33 | + - reassign # Checks that package variables are not reassigned. |
| 34 | + - revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. |
| 35 | + - staticcheck # It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint. |
| 36 | + - tenv # # Tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17. |
| 37 | + - unconvert # Remove unnecessary type conversions. |
| 38 | + - unused # Checks Go code for unused constants, variables, functions and types. |
| 39 | + |
| 40 | +linters-settings: |
| 41 | + # See https://golangci-lint.run/usage/linters/#linters-configuration |
| 42 | + forbidigo: |
| 43 | + forbid: |
| 44 | + - 'fmt\.Print.*' # Should be using a logger |
| 45 | + gci: |
| 46 | + sections: |
| 47 | + - standard |
| 48 | + - default |
| 49 | + - prefix(github.com/armsnyder) |
| 50 | + gocritic: |
| 51 | + enabled-tags: |
| 52 | + - performance |
| 53 | + - opinionated |
| 54 | + - experimental |
| 55 | + disabled-checks: |
| 56 | + - whyNoLint # False positives, use nolintlint instead |
| 57 | + govet: |
| 58 | + enable-all: true |
| 59 | + disable: |
| 60 | + - fieldalignment # Too struct |
| 61 | + nolintlint: |
| 62 | + require-specific: true |
| 63 | + revive: |
| 64 | + enable-all-rules: true |
| 65 | + rules: |
| 66 | + # See https://revive.run/r |
| 67 | + - name: add-constant # too strict |
| 68 | + disabled: true |
| 69 | + - name: argument-limit # too strict |
| 70 | + disabled: true |
| 71 | + - name: cognitive-complexity |
| 72 | + arguments: |
| 73 | + - 30 |
| 74 | + - name: cyclomatic |
| 75 | + arguments: |
| 76 | + - 30 |
| 77 | + - name: file-header # too strict |
| 78 | + disabled: true |
| 79 | + - name: function-length |
| 80 | + arguments: |
| 81 | + - 50 # statements |
| 82 | + - 0 # lines (0 to disable) |
| 83 | + - name: function-result-limit # too strict |
| 84 | + disabled: true |
| 85 | + - name: import-shadowing # too strict, results in uglier code |
| 86 | + disabled: true |
| 87 | + - name: line-length-limit # too strict |
| 88 | + disabled: true |
| 89 | + - name: max-public-structs # too strict |
| 90 | + disabled: true |
| 91 | + - name: modifies-parameter # too strict |
| 92 | + disabled: true |
| 93 | + - name: modifies-value-receiver # too strict |
| 94 | + disabled: true |
| 95 | + - name: nested-structs # too strict |
| 96 | + disabled: true |
| 97 | + - name: package-comments # too strict |
| 98 | + disabled: true |
| 99 | + - name: unhandled-error |
| 100 | + disabled: true # not as good as errcheck |
| 101 | + |
| 102 | +issues: |
| 103 | + exclude-rules: |
| 104 | + - path: _test\.go$ |
| 105 | + linters: |
| 106 | + - gosec # too strict |
| 107 | + - noctx # too strict |
| 108 | + - path: _test\.go$ |
| 109 | + text: (cognitive-complexity|function-length|dot-imports|import-alias-naming) # too strict |
| 110 | + linters: |
| 111 | + - revive |
| 112 | + # Shadowing err is common. |
| 113 | + - text: 'shadow: declaration of "err"' |
| 114 | + linters: |
| 115 | + - govet |
| 116 | + - text: "^exported:.+stutters" # too strict and gets in the way of combining types like handlers |
| 117 | + linters: |
| 118 | + - revive |
| 119 | + - path: _test\.go$ |
| 120 | + text: "unused-parameter" # too strict |
0 commit comments