# https://golangci-lint.run/usage/linters linters: disable-all: true enable: - asciicheck - bodyclose - depguard - dogsled - errcheck - errorlint - exportloopref - gci - goconst - gocritic - gocyclo - gofmt - goimports - goprintffuncname - gosec - gosimple - govet - importas - ineffassign - misspell - nakedret - nilerr - nolintlint - prealloc - revive - staticcheck - stylecheck - typecheck - unconvert - unparam - unused - usestdlibvars - whitespace linters-settings: gci: sections: - standard - default - prefix(sigs.k8s.io/kwok) - blank - dot skip-generated: true custom-order: true importas: no-unaliased: true alias: # Kubernetes - pkg: k8s.io/api/core/v1 alias: corev1 - pkg: k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1 alias: apiextensionsv1 - pkg: k8s.io/apimachinery/pkg/apis/meta/v1 alias: metav1 - pkg: k8s.io/apimachinery/pkg/api/errors alias: apierrors stylecheck: # STxxxx checks in https://staticcheck.io/docs/configuration/options/#checks checks: ["all", "-ST1000", "-ST1003"] depguard: rules: main: deny: # https://go.dev/doc/go1.16#ioutil - pkg: "io/ioutil" desc: "please see https://go.dev/doc/go1.16#ioutil" # Use sigs.k8s.io/kwok/pkg/log, which is a wrapper around slog - pkg: "k8s.io/klog/v2" desc: "please use `sigs.k8s.io/kwok/pkg/log` instead" - pkg: "k8s.io/klog" desc: "please use `sigs.k8s.io/kwok/pkg/log` instead" - pkg: "golang.org/x/exp/slog" desc: "please use `sigs.k8s.io/kwok/pkg/log` instead" - pkg: "log/slog" desc: "please use `sigs.k8s.io/kwok/pkg/log` instead" - pkg: "log" desc: "please use `sigs.k8s.io/kwok/pkg/log` instead" # Use sigs.k8s.io/kwok/pkg/utils/yaml, which is a wrapper around yaml - pkg: "k8s.io/apimachinery/pkg/util/yaml" desc: "please use `sigs.k8s.io/kwok/pkg/utils/yaml` instead" - pkg: "sigs.k8s.io/yaml" desc: "please use `sigs.k8s.io/kwok/pkg/utils/yaml` instead" # Use sigs.k8s.io/kwok/pkg/utils/wait, which is a wrapper around wait - pkg: "k8s.io/apimachinery/pkg/util/wait" desc: "please use `sigs.k8s.io/kwok/pkg/utils/wait` instead" # Use sigs.k8s.io/kwok/pkg/utils/slices, which is a wrapper around slices - pkg: "k8s.io/utils/strings/slices" desc: "please use `sigs.k8s.io/kwok/pkg/utils/slices` instead" gocyclo: min-complexity: 50 gosec: excludes: - G110 - G304 config: G301: "0750" G302: "0640" G306: "0640" goconst: min-len: 5 min-occurrences: 10 ignore-tests: true match-constant: false revive: ignore-generated-header: true severity: error enable-all-rules: true # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md rules: - name: add-constant disabled: true - name: argument-limit disabled: true - name: cognitive-complexity disabled: true - name: confusing-naming disabled: true - name: cyclomatic disabled: true - name: early-return disabled: true - name: enforce-map-style disabled: true - name: exported disabled: true - name: file-header disabled: true - name: flag-parameter disabled: true - name: function-length disabled: true - name: get-return disabled: true - name: if-return disabled: true - name: import-shadowing disabled: true - name: line-length-limit disabled: true - name: modifies-parameter disabled: true - name: nested-structs disabled: true - name: optimize-operands-order disabled: true - name: unused-parameter disabled: true - name: unused-receiver disabled: true - name: use-any disabled: true - name: unchecked-type-assertion disabled: true - name: function-result-limit disabled: true - name: deep-exit disabled: true - name: superfluous-else disabled: true - name: confusing-results disabled: true - name: defer disabled: true - name: var-naming disabled: true - name: max-public-structs disabled: true - name: comment-spacings disabled: true - name: struct-tag disabled: true - name: unhandled-error disabled: true - name: error-strings disabled: true - name: max-control-nesting arguments: - 6 issues: max-same-issues: 0 max-issues-per-linter: 0 # We are disabling default golangci exclusions because we want to help reviewers to focus on reviewing the most relevant # changes in PRs and avoid nitpicking. exclude-use-default: false exclude-files: - ".*\\.zz_generated\\..*" run: concurrency: 1 timeout: 10m allow-parallel-runners: false allow-serial-runners: true go: "1.23.0"