# golangci-lint configuration used for CI version: "2" run: tests: true timeout: 15m linters: default: none enable: - gosec - govet - loggercheck - misspell - revive - staticcheck - unused settings: gosec: excludes: # At the time of writing this, the G115 rule is not even part of an # official release of gosec. This rule causes a lot of errors to be # reported in the codebase. While some of the reported errors should be # addressed, a lot can also be ignored and there are also some clear false # positives that should not be flagged by gosec in the first place (see # https://github.com/securego/gosec/issues/1187). We will re-enable this # rule in the future when it becomes more accurate. - G115 # Potential integer overflow when converting between integer types misspell: ignore-rules: - creater revive: confidence: 0.8 severity: warning rules: - name: unreachable-code - name: errorf - name: range - name: superfluous-else - name: var-declaration - name: duplicated-imports exclusions: presets: - legacy - common-false-positives paths: - ^third_party/.* rules: - linters: - staticcheck # ST1005: error strings must be capitalized # QF1008: unneccessary use of embedded struct name before field e.g: # ClusterNetworkPolicy.Metadata.Name vs ClusterNetworkPolicy.Name text: "(ST1005:|QF1008:)" - linters: - staticcheck text: "SA1019: (v1|corev1).Endpoints is deprecated" - linters: - staticcheck text: "SA1019: (v1|corev1).EndpointSubset is deprecated" - linters: - staticcheck # DestinationClusterIp is deprecated in favor of DestinationServiceIp, # but we still need to populate it for backward compatibility until it # is removed. text: "SA1019: .*\\.DestinationClusterIp is deprecated" - linters: - staticcheck # NewSimpleClientset is marked as deprecated, with the documentation # suggesting NewClientset as a direct replacement. However, NewClientset # is only available when apply configurations are generated (e.g. via # --with-applyconfig), which is not the case for the clientsets # generated for Antrea CRDs. # SA1019 text: "NewSimpleClientset is deprecated" - linters: - gosec # G117 warns about potential serialization of secrets as exported struct fields. # We are currently getting some false positives because of https://github.com/securego/gosec/issues/1527. # We can eventually enable this rule, but we have several locations # where we intentionally serialize secrets, e.g., in pkg/apis/controlplane. text: "G117:" formatters: enable: - gofmt - goimports settings: goimports: local-prefixes: - antrea.io/antrea/v2 exclusions: paths: - ^third_party/.* issues: max-issues-per-linter: 0 max-same-issues: 0