|
| 1 | +# https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml |
| 2 | + |
| 3 | +linters-settings: |
| 4 | + gci: |
| 5 | + sections: |
| 6 | + - standard |
| 7 | + - default |
| 8 | + - prefix(github.com/crowdsecurity) |
| 9 | + - prefix(github.com/crowdsecurity/crowdsec) |
| 10 | + - prefix(github.com/crowdsecurity/cs-custom-bouncer) |
| 11 | + |
| 12 | + govet: |
| 13 | + enable-all: true |
| 14 | + disable: |
| 15 | + - fieldalignment |
| 16 | + |
| 17 | + misspell: |
| 18 | + locale: US |
| 19 | + |
| 20 | + nlreturn: |
| 21 | + block-size: 4 |
| 22 | + |
| 23 | + nolintlint: |
| 24 | + allow-unused: false # report any unused nolint directives |
| 25 | + require-explanation: false # don't require an explanation for nolint directives |
| 26 | + require-specific: false # don't require nolint directives to be specific about which linter is being skipped |
| 27 | + |
| 28 | + depguard: |
| 29 | + rules: |
| 30 | + main: |
| 31 | + deny: |
| 32 | + - pkg: "github.com/pkg/errors" |
| 33 | + desc: "errors.Wrap() is deprecated in favor of fmt.Errorf()" |
| 34 | + |
| 35 | + stylecheck: |
| 36 | + checks: |
| 37 | + - all |
| 38 | + - -ST1003 # should not use underscores in Go names; ... |
| 39 | + - -ST1005 # error strings should not be capitalized |
| 40 | + - -ST1012 # error var ... should have name of the form ErrFoo |
| 41 | + - -ST1016 # methods on the same type should have the same receiver name |
| 42 | + - -ST1022 # comment on exported var ... should be of the form ... |
| 43 | + |
| 44 | + revive: |
| 45 | + ignore-generated-header: true |
| 46 | + severity: error |
| 47 | + enable-all-rules: true |
| 48 | + rules: |
| 49 | + - name: add-constant |
| 50 | + disabled: true |
| 51 | + - name: cognitive-complexity |
| 52 | + disabled: true |
| 53 | + - name: comment-spacings |
| 54 | + disabled: true |
| 55 | + - name: confusing-results |
| 56 | + disabled: true |
| 57 | + - name: cyclomatic |
| 58 | + disabled: true |
| 59 | + - name: empty-lines |
| 60 | + disabled: true |
| 61 | + - name: flag-parameter |
| 62 | + disabled: true |
| 63 | + - name: function-length |
| 64 | + disabled: true |
| 65 | + - name: if-return |
| 66 | + disabled: true |
| 67 | + - name: import-alias-naming |
| 68 | + disabled: true |
| 69 | + - name: import-shadowing |
| 70 | + disabled: true |
| 71 | + - name: line-length-limit |
| 72 | + disabled: true |
| 73 | + - name: nested-structs |
| 74 | + disabled: true |
| 75 | + - name: var-declaration |
| 76 | + disabled: true |
| 77 | + - name: exported |
| 78 | + disabled: true |
| 79 | + - name: unexported-naming |
| 80 | + disabled: true |
| 81 | + - name: unexported-return |
| 82 | + disabled: true |
| 83 | + - name: unhandled-error |
| 84 | + disabled: true |
| 85 | + arguments: |
| 86 | + - "fmt.Print" |
| 87 | + - "fmt.Printf" |
| 88 | + - "fmt.Println" |
| 89 | + - name: unused-receiver |
| 90 | + disabled: true |
| 91 | + - name: function-result-limit |
| 92 | + arguments: |
| 93 | + - 5 |
| 94 | + wsl: |
| 95 | + # Allow blocks to end with comments |
| 96 | + allow-trailing-comment: true |
| 97 | + |
| 98 | +linters: |
| 99 | + enable-all: true |
| 100 | + disable: |
| 101 | + # |
| 102 | + # DEPRECATED by golangi-lint |
| 103 | + # |
| 104 | + |
| 105 | + # |
| 106 | + # Redundant |
| 107 | + # |
| 108 | + |
| 109 | + - cyclop |
| 110 | + - tenv |
| 111 | + - lll |
| 112 | + - funlen |
| 113 | + - gocognit |
| 114 | + |
| 115 | + # |
| 116 | + # Recommended? (easy) |
| 117 | + # |
| 118 | + |
| 119 | + - gosec # (gas): Inspects source code for security problems |
| 120 | + - revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. |
| 121 | + - wrapcheck # Checks that errors returned from external packages are wrapped |
| 122 | + |
| 123 | + # |
| 124 | + # Recommended? (requires some work) |
| 125 | + # |
| 126 | + |
| 127 | + - contextcheck # check the function whether use a non-inherited context |
| 128 | + - mnd # An analyzer to detect magic numbers. |
| 129 | + - unparam # Reports unused function parameters |
| 130 | + |
| 131 | + # |
| 132 | + # Formatting only, useful in IDE but should not be forced on CI? |
| 133 | + # |
| 134 | + |
| 135 | + - gofumpt # Gofumpt checks whether code was gofumpt-ed. |
| 136 | + - nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity |
| 137 | + - whitespace # Whitespace is a linter that checks for unnecessary newlines at the start and end of functions, if, for, etc. |
| 138 | + - wsl # add or remove empty lines |
| 139 | + |
| 140 | + # |
| 141 | + # Well intended, but not ready for this |
| 142 | + # |
| 143 | + - dupl # Tool for code clone detection |
| 144 | + - err113 # Golang linter to check the errors handling expressions |
| 145 | + - paralleltest # paralleltest detects missing usage of t.Parallel() method in your Go test |
| 146 | + - testpackage # linter that makes you use a separate _test package |
| 147 | + |
| 148 | + # |
| 149 | + # Too strict / too many false positives (for now?) |
| 150 | + # |
| 151 | + - exhaustruct # Checks if all structure fields are initialized |
| 152 | + - forbidigo # Forbids identifiers |
| 153 | + - gochecknoglobals # check that no global variables exist |
| 154 | + - goconst # Finds repeated strings that could be replaced by a constant |
| 155 | + - tagliatelle # Checks the struct tags. |
| 156 | + - varnamelen # checks that the length of a variable's name matches its scope |
| 157 | + |
| 158 | +issues: |
| 159 | + exclude-generated: strict |
| 160 | + |
| 161 | + max-issues-per-linter: 0 |
| 162 | + max-same-issues: 10 |
| 163 | + exclude-rules: |
| 164 | + # `err` is often shadowed, we may continue to do it |
| 165 | + - linters: |
| 166 | + - govet |
| 167 | + text: "shadow: declaration of \"err\" shadows declaration" |
0 commit comments