|
| 1 | +version: "2" |
1 | 2 | run: |
2 | | - deadline: 5m |
| 3 | + go: "1.24" |
| 4 | + timeout: 10m |
| 5 | + modules-download-mode: readonly |
3 | 6 | allow-parallel-runners: true |
4 | | - |
5 | | -issues: |
6 | | - # don't skip warning about doc comments |
7 | | - # don't exclude the default set of lint |
8 | | - exclude-use-default: false |
9 | | - # restore some of the defaults |
10 | | - # (fill in the rest as needed) |
11 | | - exclude-rules: |
12 | | - - path: "api/*" |
13 | | - linters: |
14 | | - - lll |
15 | | - - path: "internal/*" |
16 | | - linters: |
17 | | - - dupl |
18 | | - - lll |
19 | 7 | linters: |
20 | | - disable-all: true |
| 8 | + # sync from https://github.com/kubernetes-sigs/controller-runtime/blob/main/.golangci.yml |
| 9 | + default: none |
21 | 10 | enable: |
| 11 | + - asasalint |
| 12 | + - asciicheck |
| 13 | + - bidichk |
| 14 | + - bodyclose |
| 15 | + - copyloopvar |
| 16 | + - dogsled |
22 | 17 | - dupl |
23 | 18 | - errcheck |
24 | | - - exportloopref |
| 19 | + - errchkjson |
| 20 | + - errorlint |
| 21 | + - forbidigo |
| 22 | + - ginkgolinter |
25 | 23 | - goconst |
| 24 | + - gocritic |
26 | 25 | - gocyclo |
27 | | - - gofmt |
28 | | - - goimports |
29 | | - - gosimple |
| 26 | + - godoclint |
| 27 | + - goprintffuncname |
30 | 28 | - govet |
| 29 | + - importas |
31 | 30 | - ineffassign |
| 31 | + - iotamixing |
| 32 | + - makezero |
32 | 33 | - misspell |
33 | 34 | - nakedret |
| 35 | + - nilerr |
| 36 | + - nolintlint |
34 | 37 | - prealloc |
| 38 | + - revive |
35 | 39 | - staticcheck |
36 | | - - typecheck |
| 40 | + - tagliatelle |
37 | 41 | - unconvert |
38 | 42 | - unparam |
39 | 43 | - unused |
| 44 | + - whitespace |
| 45 | + settings: |
| 46 | + forbidigo: |
| 47 | + forbid: |
| 48 | + - pattern: context.Background |
| 49 | + msg: Use ginkgos SpecContext or go testings t.Context instead |
| 50 | + - pattern: context.TODO |
| 51 | + msg: Use ginkgos SpecContext or go testings t.Context instead |
| 52 | + govet: |
| 53 | + disable: |
| 54 | + - fieldalignment |
| 55 | + - shadow |
| 56 | + enable-all: true |
| 57 | + importas: |
| 58 | + no-unaliased: true |
| 59 | + revive: |
| 60 | + # By default, revive will enable only the linting rules that are named in the configuration file. |
| 61 | + # So, it's needed to explicitly enable all required rules here. |
| 62 | + rules: |
| 63 | + # The following rules are recommended https://github.com/mgechev/revive#recommended-configuration |
| 64 | + - name: blank-imports |
| 65 | + - name: context-as-argument |
| 66 | + - name: context-keys-type |
| 67 | + - name: dot-imports |
| 68 | + - name: error-return |
| 69 | + - name: error-strings |
| 70 | + - name: error-naming |
| 71 | + - name: if-return |
| 72 | + - name: increment-decrement |
| 73 | + - name: var-naming |
| 74 | + - name: var-declaration |
| 75 | + - name: range |
| 76 | + - name: receiver-naming |
| 77 | + - name: time-naming |
| 78 | + - name: unexported-return |
| 79 | + - name: indent-error-flow |
| 80 | + - name: errorf |
| 81 | + - name: superfluous-else |
| 82 | + - name: unreachable-code |
| 83 | + - name: redefines-builtin-id |
| 84 | + # |
| 85 | + # Rules in addition to the recommended configuration above. |
| 86 | + # |
| 87 | + - name: bool-literal-in-expr |
| 88 | + - name: constant-logical-expr |
| 89 | + exclusions: |
| 90 | + generated: strict |
| 91 | + paths: |
| 92 | + - zz_generated.*\.go$ |
| 93 | + - .*conversion.*\.go$ |
| 94 | + presets: |
| 95 | + - comments |
| 96 | + - common-false-positives |
| 97 | + - legacy |
| 98 | + - std-error-handling |
| 99 | + rules: |
| 100 | + # Dot imports for gomega and ginkgo are allowed |
| 101 | + # within test files. |
| 102 | + - linters: |
| 103 | + - revive |
| 104 | + path: _test\.go |
| 105 | + text: should not use dot imports |
| 106 | + # Ignore error type switch case |
| 107 | + - linters: |
| 108 | + - errorlint |
| 109 | + path: pkg/loader/loader.go |
| 110 | + # Ignore test files |
| 111 | + - linters: |
| 112 | + - dupl |
| 113 | + - ginkgolinter |
| 114 | + path: _test\.go |
| 115 | + - linters: |
| 116 | + - gocritic |
| 117 | + path: pkg/markers/help.go |
| 118 | + - linters: |
| 119 | + - exhaustive |
| 120 | + path: pkg/markers/parse.go|pkg/deepcopy/traverse.go|pkg/genall/help/types.go|pkg/crd/schema.go|pkg/crd/flatten.go |
| 121 | + # Ignore consider pre-allocating variables |
| 122 | + - linters: |
| 123 | + - prealloc |
| 124 | + text: Consider pre-allocating |
| 125 | + - linters: |
| 126 | + - staticcheck |
| 127 | + path: (.+)\.go$ |
| 128 | + text: (QF1008) |
| 129 | +formatters: |
| 130 | + enable: |
| 131 | + - gofmt |
| 132 | + - goimports |
| 133 | + exclusions: |
| 134 | + generated: strict |
| 135 | + paths: |
| 136 | + - zz_generated.*\.go$ |
| 137 | + - .*conversion.*\.go$ |
0 commit comments