|
1 |
| -# https://golangci-lint.run/usage/configuration/ |
2 |
| - |
| 1 | +version: "2" |
3 | 2 | linters:
|
4 |
| - disable: |
5 |
| - - contextcheck |
6 |
| - - gofumpt |
7 | 3 | enable:
|
| 4 | + - asasalint |
| 5 | + - asciicheck |
| 6 | + - bidichk |
| 7 | + - bodyclose |
| 8 | + - depguard |
| 9 | + - durationcheck |
| 10 | + - errchkjson |
| 11 | + - errorlint |
| 12 | + - exhaustive |
| 13 | + - gocheckcompilerdirectives |
| 14 | + - gochecksumtype |
8 | 15 | - goheader
|
9 |
| - - gosimple |
| 16 | + - gomodguard |
| 17 | + - gosec |
| 18 | + - gosmopolitan |
10 | 19 | - importas
|
| 20 | + - loggercheck |
| 21 | + - makezero |
11 | 22 | - misspell
|
| 23 | + - musttag |
| 24 | + - nilerr |
| 25 | + - nilnesserr |
| 26 | + - noctx |
| 27 | + - protogetter |
| 28 | + - reassign |
| 29 | + - recvcheck |
| 30 | + - rowserrcheck |
| 31 | + - spancheck |
| 32 | + - sqlclosecheck |
| 33 | + - testifylint |
12 | 34 | - unconvert
|
13 |
| - presets: |
14 |
| - - bugs |
15 |
| - - format |
16 |
| - - import |
17 |
| - - unused |
18 |
| - |
19 |
| -linters-settings: |
20 |
| - depguard: |
| 35 | + - unparam |
| 36 | + - zerologlint |
| 37 | + disable: |
| 38 | + - contextcheck |
| 39 | + settings: |
| 40 | + depguard: |
| 41 | + rules: |
| 42 | + everything: |
| 43 | + list-mode: lax |
| 44 | + allow: |
| 45 | + - go.opentelemetry.io/otel/semconv/v1.27.0 |
| 46 | + deny: |
| 47 | + - pkg: go.opentelemetry.io/otel/semconv |
| 48 | + desc: Use "go.opentelemetry.io/otel/semconv/v1.27.0" instead. |
| 49 | + - pkg: io/ioutil |
| 50 | + desc: | |
| 51 | + Use the "io" and "os" packages instead. See https://go.dev/doc/go1.16#ioutil |
| 52 | + not-tests: |
| 53 | + files: |
| 54 | + - '!$test' |
| 55 | + deny: |
| 56 | + - pkg: net/http/httptest |
| 57 | + desc: Should be used only in tests. |
| 58 | + - pkg: testing/* |
| 59 | + desc: The "testing" packages should be used only in tests. |
| 60 | + - pkg: github.com/crunchydata/postgres-operator/internal/testing/* |
| 61 | + desc: The "internal/testing" packages should be used only in tests. |
| 62 | + - pkg: k8s.io/client-go/discovery |
| 63 | + desc: Use the "internal/kubernetes" package instead. |
| 64 | + tests: |
| 65 | + files: |
| 66 | + - $test |
| 67 | + deny: |
| 68 | + - pkg: github.com/pkg/errors |
| 69 | + desc: Use the "errors" package unless you are interacting with stack traces. |
| 70 | + errchkjson: |
| 71 | + check-error-free-encoding: true |
| 72 | + exhaustive: |
| 73 | + default-signifies-exhaustive: true |
| 74 | + goheader: |
| 75 | + values: |
| 76 | + regexp: |
| 77 | + DATES: ((201[7-9]|202[0-4]) - 2025|2025) |
| 78 | + template: |- |
| 79 | + Copyright {{ DATES }} Crunchy Data Solutions, Inc. |
| 80 | +
|
| 81 | + SPDX-License-Identifier: Apache-2.0 |
| 82 | + gomodguard: |
| 83 | + blocked: |
| 84 | + modules: |
| 85 | + - gopkg.in/yaml.v2: |
| 86 | + recommendations: |
| 87 | + - sigs.k8s.io/yaml |
| 88 | + - gopkg.in/yaml.v3: |
| 89 | + recommendations: |
| 90 | + - sigs.k8s.io/yaml |
| 91 | + - gotest.tools: |
| 92 | + recommendations: |
| 93 | + - gotest.tools/v3 |
| 94 | + - k8s.io/kubernetes: |
| 95 | + reason: | |
| 96 | + k8s.io/kubernetes is for managing dependencies of the Kubernetes project, i.e. building kubelet and kubeadm. |
| 97 | + gosec: |
| 98 | + excludes: |
| 99 | + - G115 |
| 100 | + importas: |
| 101 | + alias: |
| 102 | + - pkg: k8s.io/api/(\w+)/(v[\w\w]+) |
| 103 | + alias: $1$2 |
| 104 | + - pkg: k8s.io/apimachinery/pkg/apis/(\w+)/(v[\w\d]+) |
| 105 | + alias: $1$2 |
| 106 | + - pkg: k8s.io/apimachinery/pkg/api/errors |
| 107 | + alias: apierrors |
| 108 | + no-unaliased: true |
| 109 | + spancheck: |
| 110 | + checks: |
| 111 | + - end |
| 112 | + - record-error |
| 113 | + ignore-check-signatures: |
| 114 | + - tracing.Escape |
| 115 | + extra-start-span-signatures: |
| 116 | + - github.com/crunchydata/postgres-operator/internal/tracing.Start:opentelemetry |
| 117 | + exclusions: |
| 118 | + presets: |
| 119 | + - comments |
| 120 | + - common-false-positives |
| 121 | + - legacy |
| 122 | + - std-error-handling |
21 | 123 | rules:
|
22 |
| - everything: |
23 |
| - list-mode: lax |
24 |
| - allow: |
25 |
| - - go.opentelemetry.io/otel/semconv/v1.27.0 |
26 |
| - deny: |
27 |
| - - pkg: go.opentelemetry.io/otel/semconv |
28 |
| - desc: Use "go.opentelemetry.io/otel/semconv/v1.27.0" instead. |
29 |
| - |
30 |
| - - pkg: io/ioutil |
31 |
| - desc: > |
32 |
| - Use the "io" and "os" packages instead. |
33 |
| - See https://go.dev/doc/go1.16#ioutil |
34 |
| -
|
35 |
| - not-tests: |
36 |
| - files: ['!$test'] |
37 |
| - deny: |
38 |
| - - pkg: net/http/httptest |
39 |
| - desc: Should be used only in tests. |
40 |
| - |
41 |
| - - pkg: testing/* |
42 |
| - desc: The "testing" packages should be used only in tests. |
43 |
| - |
44 |
| - - pkg: github.com/crunchydata/postgres-operator/internal/testing/* |
45 |
| - desc: The "internal/testing" packages should be used only in tests. |
46 |
| - |
47 |
| - - pkg: k8s.io/client-go/discovery |
48 |
| - desc: Use the "internal/kubernetes" package instead. |
49 |
| - |
50 |
| - tests: |
51 |
| - files: ['$test'] |
52 |
| - deny: |
53 |
| - - pkg: github.com/pkg/errors |
54 |
| - desc: Use the "errors" package unless you are interacting with stack traces. |
55 |
| - |
56 |
| - errchkjson: |
57 |
| - check-error-free-encoding: true |
58 |
| - |
59 |
| - exhaustive: |
60 |
| - default-signifies-exhaustive: true |
61 |
| - |
62 |
| - gci: |
63 |
| - sections: |
64 |
| - - standard |
65 |
| - - default |
66 |
| - - localmodule |
67 |
| - |
68 |
| - goheader: |
69 |
| - template: |- |
70 |
| - Copyright {{ DATES }} Crunchy Data Solutions, Inc. |
71 |
| -
|
72 |
| - SPDX-License-Identifier: Apache-2.0 |
73 |
| - values: |
74 |
| - regexp: |
75 |
| - DATES: '((201[7-9]|202[0-4]) - 2025|2025)' |
76 |
| - |
77 |
| - gomodguard: |
78 |
| - blocked: |
79 |
| - modules: |
80 |
| - - gopkg.in/yaml.v2: { recommendations: [sigs.k8s.io/yaml] } |
81 |
| - - gopkg.in/yaml.v3: { recommendations: [sigs.k8s.io/yaml] } |
82 |
| - - gotest.tools: { recommendations: [gotest.tools/v3] } |
83 |
| - - k8s.io/kubernetes: |
84 |
| - reason: > |
85 |
| - k8s.io/kubernetes is for managing dependencies of the Kubernetes |
86 |
| - project, i.e. building kubelet and kubeadm. |
87 |
| -
|
88 |
| - gosec: |
89 |
| - excludes: |
90 |
| - # Flags for potentially-unsafe casting of ints, similar problem to globally-disabled G103 |
91 |
| - - G115 |
92 |
| - |
93 |
| - importas: |
94 |
| - alias: |
95 |
| - - pkg: k8s.io/api/(\w+)/(v[\w\w]+) |
96 |
| - alias: $1$2 |
97 |
| - - pkg: k8s.io/apimachinery/pkg/apis/(\w+)/(v[\w\d]+) |
98 |
| - alias: $1$2 |
99 |
| - - pkg: k8s.io/apimachinery/pkg/api/errors |
100 |
| - alias: apierrors |
101 |
| - no-unaliased: true |
102 |
| - |
103 |
| - spancheck: |
104 |
| - checks: [end, record-error] |
105 |
| - extra-start-span-signatures: |
106 |
| - - 'github.com/crunchydata/postgres-operator/internal/tracing.Start:opentelemetry' |
107 |
| - ignore-check-signatures: |
108 |
| - - 'tracing.Escape' |
109 |
| - |
110 |
| -issues: |
111 |
| - exclude-generated: strict |
112 |
| - exclude-rules: |
113 |
| - # This internal package is the one place we want to do API discovery. |
114 |
| - - linters: [depguard] |
115 |
| - path: internal/kubernetes/discovery.go |
116 |
| - text: k8s.io/client-go/discovery |
117 |
| - |
118 |
| - # These value types have unmarshal methods. |
119 |
| - # https://github.com/raeperd/recvcheck/issues/7 |
120 |
| - - linters: [recvcheck] |
121 |
| - path: internal/pki/pki.go |
122 |
| - text: 'methods of "(Certificate|PrivateKey)"' |
| 124 | + - linters: |
| 125 | + - depguard |
| 126 | + path: internal/kubernetes/discovery.go |
| 127 | + text: k8s.io/client-go/discovery |
| 128 | + - linters: |
| 129 | + - recvcheck |
| 130 | + path: internal/pki/pki.go |
| 131 | + text: methods of "(Certificate|PrivateKey)" |
| 132 | + paths: |
| 133 | + - third_party$ |
| 134 | + - builtin$ |
| 135 | + - examples$ |
| 136 | +formatters: |
| 137 | + enable: |
| 138 | + - gci |
| 139 | + - gofmt |
| 140 | + - goimports |
| 141 | + settings: |
| 142 | + gci: |
| 143 | + sections: |
| 144 | + - standard |
| 145 | + - default |
| 146 | + - localmodule |
| 147 | + exclusions: |
| 148 | + paths: |
| 149 | + - third_party$ |
| 150 | + - builtin$ |
| 151 | + - examples$ |
0 commit comments