|
| 1 | +# Config for golangci-lint |
| 2 | + |
| 3 | +# output configuration options |
| 4 | + |
| 5 | +# all available settings of specific linters |
| 6 | +linters-settings: |
| 7 | + gocritic: |
| 8 | + disabled-checks: |
| 9 | + - ifElseChain |
| 10 | + dupl: |
| 11 | + # tokens count to trigger issue, 150 by default |
| 12 | + threshold: 100 |
| 13 | + exhaustive: |
| 14 | + # indicates that switch statements are to be considered exhaustive if a |
| 15 | + # 'default' case is present, even if all enum members aren't listed in the |
| 16 | + # switch |
| 17 | + default-signifies-exhaustive: false |
| 18 | + funlen: |
| 19 | + lines: 140 |
| 20 | + statements: 70 |
| 21 | + gocognit: |
| 22 | + # minimal code complexity to report, 30 by default (but we recommend 10-20) |
| 23 | + min-complexity: 42 |
| 24 | + nestif: |
| 25 | + # minimal complexity of if statements to report, 5 by default |
| 26 | + min-complexity: 4 |
| 27 | + gocyclo: |
| 28 | + # minimal code complexity to report, 30 by default (but we recommend 10-20) |
| 29 | + min-complexity: 30 |
| 30 | + godot: |
| 31 | + # check all top-level comments, not only declarations |
| 32 | + check-all: false |
| 33 | + govet: |
| 34 | + # report about shadowed variables |
| 35 | + check-shadowing: true |
| 36 | + # settings per analyzer |
| 37 | + settings: |
| 38 | + printf: # analyzer name, run `go tool vet help` to see all analyzers |
| 39 | + funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer |
| 40 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof |
| 41 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf |
| 42 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf |
| 43 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf |
| 44 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Printf |
| 45 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).FErrf |
| 46 | + enable-all: true |
| 47 | + disable-all: false |
| 48 | + lll: |
| 49 | + # max line length, lines longer will be reported. Default is 120. |
| 50 | + # '\t' is counted as 1 character by default, and can be changed with the tab-width option |
| 51 | + line-length: 132 |
| 52 | + # tab width in spaces. Default to 1. |
| 53 | + tab-width: 1 |
| 54 | + misspell: |
| 55 | + # Correct spellings using locale preferences for US or UK. |
| 56 | + # Default is to use a neutral variety of English. |
| 57 | + # Setting locale to US will correct the British spelling of 'colour' to 'color'. |
| 58 | + locale: US |
| 59 | + ignore-words: |
| 60 | + - fortio |
| 61 | + nakedret: |
| 62 | + # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 |
| 63 | + max-func-lines: 30 |
| 64 | + nolintlint: |
| 65 | + require-specific: true |
| 66 | + whitespace: |
| 67 | + multi-if: false # Enforces newlines (or comments) after every multi-line if statement |
| 68 | + multi-func: false # Enforces newlines (or comments) after every multi-line function signature |
| 69 | + gofumpt: |
| 70 | + # Choose whether or not to use the extra rules that are disabled |
| 71 | + # by default |
| 72 | + extra-rules: false |
| 73 | + |
| 74 | + |
| 75 | +linters: |
| 76 | + disable: |
| 77 | + # bad ones: |
| 78 | + - musttag |
| 79 | + # Deprecated ones: |
| 80 | + - scopelint |
| 81 | + - golint |
| 82 | + - interfacer |
| 83 | + - maligned |
| 84 | + - varcheck |
| 85 | + - structcheck |
| 86 | + - nosnakecase |
| 87 | + - deadcode |
| 88 | + # Weird/bad ones: |
| 89 | + - wsl |
| 90 | + - nlreturn |
| 91 | + - gochecknoinits |
| 92 | + - gochecknoglobals |
| 93 | + - gomnd |
| 94 | + - testpackage |
| 95 | + - wrapcheck |
| 96 | + - exhaustivestruct |
| 97 | + - tagliatelle |
| 98 | + - nonamedreturns |
| 99 | + - varnamelen |
| 100 | + - exhaustruct # seems like a good idea at first but actually a pain and go does have zero values for a reason. |
| 101 | +# TODO consider putting these back, when they stop being bugged (ifshort, wastedassign,...) |
| 102 | + - paralleltest |
| 103 | + - thelper |
| 104 | + - forbidigo |
| 105 | + - ifshort |
| 106 | + - wastedassign |
| 107 | + - cyclop |
| 108 | + - forcetypeassert |
| 109 | + - ireturn |
| 110 | + - depguard |
| 111 | + # TODO bis: do put that one back: |
| 112 | + - lll |
| 113 | + enable-all: true |
| 114 | + disable-all: false |
| 115 | + # Must not use fast: true in newer golangci-lint or it'll just skip a bunch of linter instead of doing caching like before (!) |
| 116 | + fast: false |
| 117 | + |
| 118 | + |
| 119 | +issues: |
| 120 | + # Excluding configuration per-path, per-linter, per-text and per-source |
| 121 | + exclude-rules: |
| 122 | + # Exclude some linters from running on tests files. |
| 123 | + - path: _test\.go |
| 124 | + linters: |
| 125 | + - gocyclo |
| 126 | + - errcheck |
| 127 | + - dupl |
| 128 | + - gosec |
| 129 | + - gochecknoinits |
| 130 | + - gochecknoglobals |
| 131 | + - forcetypeassert |
| 132 | + - nosnakecase |
| 133 | + - noctx |
| 134 | + |
| 135 | + # Exclude lll issues for long lines with go:generate |
| 136 | + - linters: |
| 137 | + - lll |
| 138 | + source: "^//go:generate " |
| 139 | + - linters: |
| 140 | + - goerr113 |
| 141 | + text: "do not define dynamic errors" |
| 142 | + - linters: |
| 143 | + - govet |
| 144 | + text: "fieldalignment:" |
| 145 | + - linters: |
| 146 | + - godox |
| 147 | + text: "TODO" |
| 148 | + - linters: |
| 149 | + - nosnakecase |
| 150 | + text: "grpc_|_SERVING|O_" |
| 151 | + |
| 152 | + # Maximum issues count per one linter. Set to 0 to disable. Default is 50. |
| 153 | + max-issues-per-linter: 0 |
| 154 | + |
| 155 | + # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. |
| 156 | + max-same-issues: 0 |
| 157 | + |
| 158 | +severity: |
| 159 | + # Default value is empty string. |
| 160 | + # Set the default severity for issues. If severity rules are defined and the issues |
| 161 | + # do not match or no severity is provided to the rule this will be the default |
| 162 | + # severity applied. Severities should match the supported severity names of the |
| 163 | + # selected out format. |
| 164 | + # - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity |
| 165 | + # - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity |
| 166 | + # - Github: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message |
| 167 | + default-severity: error |
| 168 | + |
| 169 | + # The default value is false. |
| 170 | + # If set to true severity-rules regular expressions become case sensitive. |
| 171 | + case-sensitive: false |
0 commit comments