|
| 1 | +linters-settings: |
| 2 | + depguard: |
| 3 | + list-type: blacklist |
| 4 | + packages: |
| 5 | + # Following logging implementations are allowed: |
| 6 | + # k8s.io/klog |
| 7 | + # go.uber.org/zap |
| 8 | + # go-logr/logr |
| 9 | + # |
| 10 | + # note that the following list will grow. |
| 11 | + - github.com/google/glog |
| 12 | + - log |
| 13 | + - github.com/sirupsen/logrus |
| 14 | + - github.com/wojas/genericr |
| 15 | + - logfmt |
| 16 | + packages-with-error-message: |
| 17 | + - github.com/google/glog: "Use klog, zap, or logr for logging." |
| 18 | + - log: "Use klog, zap, or logr for logging." |
| 19 | + - github.com/sirupsen/logrus: "Use klog, zap, or logr for logging." |
| 20 | + - github.com/wojas/genericr: "Use klog, zap, or logr for logging." |
| 21 | + - logfmt: "Use klog, zap, or logr for logging." |
| 22 | + dupl: |
| 23 | + threshold: 200 |
| 24 | + errorlint: |
| 25 | + # Use '%w' to format errors. |
| 26 | + errorf: true |
| 27 | + exhaustive: |
| 28 | + # Ignore auto-generated code. |
| 29 | + check-generated: false |
| 30 | + default-signifies-exhaustive: false |
| 31 | + forbidigo: |
| 32 | + forbid: |
| 33 | + # Forbid 'fmt.Print[|f|ln]() in shipping code. |
| 34 | + - 'fmt\.Print.*' |
| 35 | + funlen: |
| 36 | + lines: 100 |
| 37 | + statements: 50 |
| 38 | + goconst: |
| 39 | + min-len: 2 |
| 40 | + min-occurrences: 2 |
| 41 | + gocritic: |
| 42 | + enabled-tags: |
| 43 | + - diagnostic |
| 44 | + - experimental |
| 45 | + - opinionated |
| 46 | + - performance |
| 47 | + - style |
| 48 | + disabled-checks: |
| 49 | + - dupImport # https://github.com/go-critic/go-critic/issues/845 |
| 50 | + - ifElseChain |
| 51 | + - octalLiteral |
| 52 | + - whyNoLint # conflicts with nolintlint config providing superset functionality |
| 53 | + - wrapperFunc |
| 54 | + gocyclo: |
| 55 | + min-complexity: 20 |
| 56 | + goimports: |
| 57 | + local-prefixes: github.com/projectsveltos |
| 58 | + gomnd: |
| 59 | + settings: |
| 60 | + mnd: |
| 61 | + # don't include the "operation" and "assign" |
| 62 | + checks: argument,case,condition,return |
| 63 | + gomodguard: |
| 64 | + # Although this is almost empty, we will evolve the list below with the |
| 65 | + # modules we shouldn't use for technical and/or security reasons. |
| 66 | + blocked: |
| 67 | + modules: |
| 68 | + - k8s.io/kubernetes: |
| 69 | + reason: "There is no good, avoidable reason to use this package and often leads to issues such as https://bit.ly/3dlKScY. However, if you disagree please include @ravchama in code review highlighting the reason." |
| 70 | + versions: |
| 71 | + # Don't merge replace directives using local path. |
| 72 | + local_replace_directives: true |
| 73 | + govet: |
| 74 | + check-shadowing: true |
| 75 | + settings: |
| 76 | + printf: |
| 77 | + funcs: |
| 78 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof |
| 79 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf |
| 80 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf |
| 81 | + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf |
| 82 | + grouper: |
| 83 | + const-require-grouping: true |
| 84 | + import-require-single-import: true |
| 85 | + import-require-grouping: true |
| 86 | + var-require-grouping: true |
| 87 | + lll: |
| 88 | + line-length: 160 |
| 89 | + maintidx: |
| 90 | + # check https://bit.ly/3tlJX3n for maintainability index. |
| 91 | + ## |
| 92 | + # starting with 25 to begin with, with the plan to bump it to 40 eventuallly. |
| 93 | + ## |
| 94 | + under: 25 |
| 95 | + misspell: |
| 96 | + locale: US |
| 97 | + nolintlint: |
| 98 | + allow-unused: false # report any unused nolint directives |
| 99 | + require-explanation: true # require an explanation for nolint directives |
| 100 | + require-specific: true # require nolint directives to be specific about which linter is being skipped |
| 101 | + revive: |
| 102 | + ignore-generated-header: true |
| 103 | + # this is a new linter, so let's start with Warning instead of errors to |
| 104 | + # begin with. |
| 105 | + severity: warning |
| 106 | + whitespace: |
| 107 | + multi-if: true |
| 108 | + multi-func: true |
| 109 | + |
| 110 | +linters: |
| 111 | + # please, do not use `enable-all`: it's deprecated and will be removed soon. |
| 112 | + # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint |
| 113 | + disable-all: true |
| 114 | + fast: false |
| 115 | + enable: |
| 116 | + - bidichk |
| 117 | + - containedctx |
| 118 | + - bodyclose |
| 119 | + - depguard |
| 120 | + - dogsled |
| 121 | + - dupl |
| 122 | + - durationcheck |
| 123 | + - errcheck |
| 124 | + - errname |
| 125 | + - errorlint |
| 126 | + - exhaustive |
| 127 | + - exportloopref |
| 128 | + - forbidigo |
| 129 | + - funlen |
| 130 | + - goconst |
| 131 | + - gocritic |
| 132 | + - gocyclo |
| 133 | + - gofmt |
| 134 | + - goimports |
| 135 | + - gomnd |
| 136 | + - gomodguard |
| 137 | + - goprintffuncname |
| 138 | + - gosec |
| 139 | + - gosimple |
| 140 | + - govet |
| 141 | + - grouper |
| 142 | + - ineffassign |
| 143 | + - lll |
| 144 | + - misspell |
| 145 | + - maintidx |
| 146 | + - nakedret |
| 147 | + - noctx |
| 148 | + - nolintlint |
| 149 | + - nosprintfhostport |
| 150 | + - predeclared |
| 151 | + - revive |
| 152 | + - staticcheck |
| 153 | + - typecheck |
| 154 | + - unconvert |
| 155 | + - unparam |
| 156 | + - unused |
| 157 | + - whitespace |
| 158 | + |
| 159 | + # don't enable: |
| 160 | + # - asciicheck |
| 161 | + # - exhaustivestruct # applicable to special cases. |
| 162 | + # - gochecknoglobals |
| 163 | + # - gocognit |
| 164 | + # - godot |
| 165 | + # - godox |
| 166 | + # - goerr113 |
| 167 | + # - golint # deprecated |
| 168 | + # - interfacer # deprecated |
| 169 | + # - maligned #deprecated |
| 170 | + # - nestif |
| 171 | + # - prealloc |
| 172 | + # - scopelint # deprecated |
| 173 | + # - testpackage |
| 174 | + # - wsl |
| 175 | + |
| 176 | +issues: |
| 177 | + # Excluding configuration per path, per linter, per text and per-source |
| 178 | + exclude-rules: |
| 179 | + - path: _test\.go |
| 180 | + linters: |
| 181 | + - gomnd |
| 182 | + - grouper |
| 183 | + - maintidx |
| 184 | + |
| 185 | + # https://github.com/go-critic/go-critic/issues/926 |
| 186 | + - linters: |
| 187 | + - gocritic |
| 188 | + text: "unnecessaryDefer:" |
| 189 | + # Maximum issues count per one linter. |
| 190 | + # Set to 0 to disable. |
| 191 | + max-issues-per-linter: 0 |
| 192 | + # Maximum count of issues with the same text. |
| 193 | + # Set to 0 to disable. |
| 194 | + max-same-issues: 0 |
| 195 | + |
| 196 | +run: |
| 197 | + # Allow multiple parallel golangci-lint instances running. |
| 198 | + allow-parallel-runners: true |
| 199 | + # Timeout for analysis |
| 200 | + timeout: 5m |
| 201 | + # files to skip: they will be analyzed, but issues from them won't be reported. |
| 202 | + skip-dirs: |
| 203 | + - cmd/example/gen |
0 commit comments