|
| 1 | +version: "2" |
| 2 | +linters: |
| 3 | + # Project stance regarding linting - see also https://github.com/go-swagger/go-swagger/issues/3237: |
| 4 | + # |
| 5 | + # * we enable all linters by default |
| 6 | + # * we disable explicitly linters which: |
| 7 | + # * do not correspond to our own views of go best practices (e.g. recvcheck, nonamedreturns) |
| 8 | + # * impose a lot of (cosmetic) changes for no real value AND do not provide an auto-fix (e.g. godox, nlreturn) |
| 9 | + # * impose a lot of not-cosmetic changes with no high value AND do not provide an auto-fix (e.g. err113) |
| 10 | + # * introduce breaking changes (normally, we should disable them sparingly with code hints, no globally) |
| 11 | + # * we overall agree with but are temporarily disabled: these issues would be addressed progressively |
| 12 | + # |
| 13 | + # This project has been living around for about 10 years now. |
| 14 | + # It adopted golangci-lint as one of its early adopters. |
| 15 | + # Since then, we've seen a lot of back and forth on how we should write good go code. |
| 16 | + # So we pick every month's new doxa with a pinch of salt. |
| 17 | + default: all |
| 18 | + disable: |
| 19 | + - dupl # temporary => should be disabled sparingly |
| 20 | + - err113 # temporary |
| 21 | + - exhaustruct # temporary |
| 22 | + - funlen # temporary |
| 23 | + - gochecknoglobals # agree, but breaking |
| 24 | + - gochecknoinits # agree, but breaking |
| 25 | + - godox # temporary |
| 26 | + - ireturn # temporary |
| 27 | + - lll # unclear added value |
| 28 | + - nestif # temporary |
| 29 | + - nonamedreturns # unclear added value |
| 30 | + - nlreturn # unclear added value |
| 31 | + - noinlineerr # unclear added value |
| 32 | + - paralleltest # unclear added value |
| 33 | + - recvcheck # disagree |
| 34 | + - tagliatelle # false positives, want to impose camel case everywhere => should be disabled sparingly only |
| 35 | + - testpackage # disagree: we like test packages, just not for everything like the linter suggests |
| 36 | + - thelper |
| 37 | + - tparallel |
| 38 | + - varnamelen |
| 39 | + - whitespace |
| 40 | + - wrapcheck |
| 41 | + - wsl |
| 42 | + - wsl_v5 |
| 43 | + settings: |
| 44 | + depguard: |
| 45 | + rules: |
| 46 | + main: |
| 47 | + list-mode: lax |
| 48 | + deny: |
| 49 | + - pkg: github.com/pkg/errors |
| 50 | + desc: Use errors or fmt instead of github.com/pkg/errors |
| 51 | + dupl: |
| 52 | + threshold: 200 |
| 53 | + goconst: |
| 54 | + min-len: 2 |
| 55 | + min-occurrences: 3 |
| 56 | + cyclop: |
| 57 | + max-complexity: 32 |
| 58 | + gocyclo: |
| 59 | + min-complexity: 32 |
| 60 | + gocognit: |
| 61 | + min-complexity: 32 |
| 62 | + govet: |
| 63 | + enable-all: true |
| 64 | + disable: |
| 65 | + - fieldalignment |
| 66 | + exhaustive: |
| 67 | + default-signifies-exhaustive: true |
| 68 | + default-case-required: true |
| 69 | + lll: |
| 70 | + line-length: 180 |
| 71 | + exclusions: |
| 72 | + warn-unused: false |
| 73 | + generated: lax # enable linting on generated code (in examples, in generated code under test) |
| 74 | + presets: |
| 75 | + - comments |
| 76 | + - common-false-positives |
| 77 | + - legacy |
| 78 | + - std-error-handling |
| 79 | + paths: |
| 80 | + - fixtures/ |
| 81 | + rules: |
| 82 | + - path: 'generator/generated/' |
| 83 | + linters: |
| 84 | + - gofumpt # we don't run gofumpt on generated code (used during testing) |
| 85 | + - path: _test.go |
| 86 | + linters: |
| 87 | + - unparam |
| 88 | +formatters: |
| 89 | + enable: |
| 90 | + - gofmt |
| 91 | + - goimports |
| 92 | + - gofumpt |
| 93 | + settings: |
| 94 | + # local prefixes regroup imports from these packages |
| 95 | + goimports: |
| 96 | + local-prefixes: |
| 97 | + - github.com/go-openapi |
| 98 | + - github.com/go-swagger/go-swagger # this is for imports in generated examples |
| 99 | + exclusions: |
| 100 | + generated: lax |
| 101 | + paths: |
| 102 | + - fixtures/ |
| 103 | +issues: |
| 104 | + # Maximum issues count per one linter. |
| 105 | + # Set to 0 to disable. |
| 106 | + # Default: 50 |
| 107 | + max-issues-per-linter: 0 |
| 108 | + # Maximum count of issues with the same text. |
| 109 | + # Set to 0 to disable. |
| 110 | + # Default: 3 |
| 111 | + max-same-issues: 0 |
| 112 | + new: false |
0 commit comments