| 1 | # Copyright 2019 The Kubernetes Authors. |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | |
| 4 | run: |
| 5 | deadline: 5m |
| 6 | go: "1.24" |
| 7 | |
| 8 | linters: |
| 9 | enable-all: true |
| 10 | disable: |
| 11 | - cyclop |
| 12 | - depguard |
| 13 | - exhaustivestruct |
| 14 | - forbidigo |
| 15 | - funlen |
| 16 | - gci |
| 17 | - gocognit |
| 18 | - godot |
| 19 | - godox |
| 20 | - goerr113 |
| 21 | - gofumpt |
| 22 | - ifshort # too many false positives |
| 23 | - ireturn |
| 24 | - nilnil |
| 25 | - nlreturn |
| 26 | - noctx |
| 27 | - paralleltest |
| 28 | - perfsprint |
| 29 | - stylecheck |
| 30 | - testifylint |
| 31 | - varnamelen |
| 32 | - wsl |
| 33 | - exhaustruct |
| 34 | - deadcode |
| 35 | - scopelint |
| 36 | - nonamedreturns |
| 37 | - golint |
| 38 | - maintidx |
| 39 | - nosnakecase |
| 40 | - testpackage # it's better to keep tests in the same package for now because kustomize does open box testing |
| 41 | - structcheck # abandoned by author |
| 42 | - varcheck # abandoned by author |
| 43 | - maligned # abandoned by author |
| 44 | - interfacer # archived by author |
| 45 | # TODO(koba1t): temporarily disabled, will be addressed after upgrading to Go 1.24 |
| 46 | - usetesting |
| 47 | - mnd |
| 48 | - copyloopvar |
| 49 | - intrange |
| 50 | |
| 51 | linters-settings: |
| 52 | dupl: |
| 53 | threshold: 400 |
| 54 | lll: |
| 55 | line-length: 170 |
| 56 | gocyclo: |
| 57 | min-complexity: 30 |
| 58 | revive: |
| 59 | rules: |
| 60 | - name: var-naming |
| 61 | arguments: |
| 62 | - ["ID", "API", "JSON"] # AllowList |
| 63 | - [] # DenyList |
| 64 | gomnd: |
| 65 | ignored-functions: |
| 66 | - os.WriteFile |
| 67 | - make |
| 68 | gomoddirectives: |
| 69 | replace-local: true |
| 70 | gosec: |
| 71 | config: |
| 72 | G306: "0644" |
| 73 | wrapcheck: |
| 74 | ignoreSigs: |
| 75 | # defaults |
| 76 | - .Errorf( |
| 77 | - errors.New( |
| 78 | - errors.Unwrap( |
| 79 | - .Wrap( |
| 80 | - .Wrapf( |
| 81 | - .WithMessage( |
| 82 | - .WithMessagef( |
| 83 | - .WithStack( |
| 84 | # from kyaml's errors package |
| 85 | - .WrapPrefixf( |
| 86 | |
| 87 | issues: |
| 88 | new-from-rev: c94b5d8f2 # enables us to enforce a larger set of linters for new code than pass on existing code |
| 89 | max-same-issues: 0 |
| 90 | exclude-rules: |
| 91 | - linters: |
| 92 | - revive |
| 93 | text: "don't use leading" |
| 94 | - linters: |
| 95 | - staticcheck |
| 96 | text: "SA1019: kioutil.Legacy" |