|
| 1 | +run: |
| 2 | + deadline: 5m |
| 3 | + skip-dirs: |
| 4 | + - mock* |
| 5 | + skip-files: |
| 6 | + - "zz_generated.*\\.go$" |
| 7 | + - ".*conversion.*\\.go$" |
| 8 | +linters: |
| 9 | + disable-all: true |
| 10 | + enable: |
| 11 | + - asciicheck |
| 12 | + - bodyclose |
| 13 | + - dogsled |
| 14 | + # - errcheck |
| 15 | + # - errorlint |
| 16 | + - exportloopref |
| 17 | + # - goconst |
| 18 | + # - gocritic |
| 19 | + # - godot |
| 20 | + # - gofmt |
| 21 | + # - goimports |
| 22 | + # - gosimple |
| 23 | + # - govet |
| 24 | + # - importas |
| 25 | + # - gosec |
| 26 | + # - ineffassign |
| 27 | + # - misspell |
| 28 | + # - nakedret |
| 29 | + # - nilerr |
| 30 | + # - noctx |
| 31 | + # - nolintlint |
| 32 | + # - prealloc |
| 33 | + # - predeclared |
| 34 | + # - revive |
| 35 | + # - rowserrcheck |
| 36 | + # - staticcheck |
| 37 | + # - stylecheck |
| 38 | + # - thelper |
| 39 | + # - typecheck |
| 40 | + # - unconvert |
| 41 | + # - unused |
| 42 | + # - whitespace |
| 43 | + # Run with --fast=false for more extensive checks |
| 44 | + fast: true |
| 45 | + |
| 46 | +linters-settings: |
| 47 | + gosec: |
| 48 | + go: "1.20" |
| 49 | + severity: medium |
| 50 | + confidence: medium |
| 51 | + concurrency: 8 |
| 52 | + importas: |
| 53 | + no-unaliased: true |
| 54 | + alias: |
| 55 | + # Kubernetes |
| 56 | + - pkg: k8s.io/api/core/v1 |
| 57 | + alias: corev1 |
| 58 | + - pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1 |
| 59 | + alias: apiextensionsv1 |
| 60 | + - pkg: k8s.io/apimachinery/pkg/apis/meta/v1 |
| 61 | + alias: metav1 |
| 62 | + - pkg: k8s.io/apimachinery/pkg/api/errors |
| 63 | + alias: k8serrors |
| 64 | + - pkg: k8s.io/apimachinery/pkg/util/errors |
| 65 | + alias: kerrors |
| 66 | + - pkg: k8s.io/component-base/logs/api/v1 |
| 67 | + alias: logsv1 |
| 68 | + # Controller Runtime |
| 69 | + - pkg: sigs.k8s.io/controller-runtime |
| 70 | + alias: ctrl |
| 71 | + # BMO |
| 72 | + - pkg: github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1 |
| 73 | + alias: metal3api |
| 74 | + nolintlint: |
| 75 | + allow-unused: false |
| 76 | + allow-leading-space: false |
| 77 | + require-specific: true |
| 78 | + staticcheck: |
| 79 | + go: "1.20" |
| 80 | + stylecheck: |
| 81 | + go: "1.20" |
| 82 | + gocritic: |
| 83 | + enabled-tags: |
| 84 | + - experimental |
| 85 | + disabled-checks: |
| 86 | + - appendAssign |
| 87 | + - dupImport # https://github.com/go-critic/go-critic/issues/845 |
| 88 | + - evalOrder |
| 89 | + - ifElseChain |
| 90 | + - octalLiteral |
| 91 | + - regexpSimplify |
| 92 | + - sloppyReassign |
| 93 | + - truncateCmp |
| 94 | + - typeDefFirst |
| 95 | + - unnamedResult |
| 96 | + - unnecessaryDefer |
| 97 | + - whyNoLint |
| 98 | + - wrapperFunc |
| 99 | + unused: |
| 100 | + go: "1.20" |
| 101 | +issues: |
| 102 | + exclude-rules: |
| 103 | + - path: test/e2e |
| 104 | + linters: |
| 105 | + - gosec |
| 106 | + - path: _test\.go |
| 107 | + linters: |
| 108 | + - unused |
| 109 | + # Specific exclude rules for deprecated fields that are still part of the codebase. |
| 110 | + # These should be removed as the referenced deprecated item is removed from the project. |
| 111 | + - linters: |
| 112 | + - staticcheck |
| 113 | + text: "SA1019:" |
| 114 | + # Disable linters for conversion |
| 115 | + - linters: |
| 116 | + - staticcheck |
| 117 | + text: "SA1019:" |
| 118 | + path: .*(api|types)\/.*\/conversion.*\.go$ |
| 119 | + # Dot imports for gomega or ginkgo are allowed |
| 120 | + # within test files. |
| 121 | + - path: _test\.go |
| 122 | + text: should not use dot imports |
| 123 | + - path: (test|e2e)/.*.go |
| 124 | + text: should not use dot imports |
| 125 | + - linters: |
| 126 | + - revive |
| 127 | + text: "exported: exported method .*\\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported" |
| 128 | + # Exclude some packages or code to require comments, for example test code, or fake clients. |
| 129 | + - linters: |
| 130 | + - revive |
| 131 | + text: exported (method|function|type|const) (.+) should have comment or be unexported |
| 132 | + source: (func|type).*Fake.* |
| 133 | + - linters: |
| 134 | + - revive |
| 135 | + text: exported (method|function|type|const) (.+) should have comment or be unexported |
| 136 | + path: fake_\.go |
| 137 | + - linters: |
| 138 | + - revive |
| 139 | + text: exported (method|function|type|const) (.+) should have comment or be unexported |
| 140 | + path: .*(api|types)\/.*\/conversion.*\.go$ |
| 141 | + - linters: |
| 142 | + - revive |
| 143 | + text: "var-naming: don't use underscores in Go names;" |
| 144 | + path: .*(api|types)\/.*\/conversion.*\.go$ |
| 145 | + - linters: |
| 146 | + - revive |
| 147 | + text: "receiver-naming: receiver name" |
| 148 | + path: .*(api|types)\/.*\/conversion.*\.go$ |
| 149 | + - linters: |
| 150 | + - stylecheck |
| 151 | + text: "ST1003: should not use underscores in Go names;" |
| 152 | + path: .*(api|types)\/.*\/conversion.*\.go$ |
| 153 | + - linters: |
| 154 | + - stylecheck |
| 155 | + text: "ST1016: methods on the same type should have the same receiver name" |
| 156 | + path: .*(api|types)\/.*\/conversion.*\.go$ |
| 157 | + include: |
| 158 | + - EXC0002 # include "missing comments" issues from golangci-lint |
| 159 | + max-issues-per-linter: 0 |
| 160 | + max-same-issues: 0 |
0 commit comments