-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: switch to rp standard ci setting
- Loading branch information
1 parent
118409b
commit e7c875a
Showing
1 changed file
with
60 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,179 +1,113 @@ | ||
run: | ||
skip-dirs: | ||
- proto/gen # Generated package. We can ignore | ||
allow-parallel-runners: true | ||
go: "1.21" | ||
|
||
# golangci-lint by default ignores some staticcheck and vet raised issues that | ||
# are actually important to catch. The following ensures that we do not ignore | ||
# those tools ever. | ||
issues: | ||
exclude-rules: | ||
- linters: | ||
- goconst | ||
text: "string `UNSPECIFIED` has" | ||
path: redpanda/utils/utils.go | ||
- linters: | ||
- goconst | ||
text: "string `ANY` has" | ||
path: redpanda/utils/utils.go | ||
- linters: | ||
- goconst | ||
text: "string `UNKNOWN` has" | ||
path: redpanda/utils/utils.go | ||
|
||
exclude-use-default: false | ||
max-same-issues: 0 # 0 is unlimited | ||
exclude: | ||
- Deferring unsafe method "Close" on type "io\.ReadCloser" | ||
|
||
# We opt out of all suggested linters and manually pick what we want. | ||
# Please do not use enable-all. | ||
linters: | ||
disable-all: true | ||
enable: | ||
# https://golangci-lint.run/usage/linters/#enabled-by-default | ||
# Enabled by default linters: we want all, except errcheck | ||
# Enabled by default linters: | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
- typecheck | ||
- unused | ||
# Not enabled by default: we want a good chunk | ||
- asasalint | ||
# Disabled by default | ||
- asciicheck | ||
- bidichk | ||
- bodyclose | ||
- containedctx | ||
- contextcheck | ||
- cyclop | ||
- decorder | ||
- dupword | ||
- durationcheck | ||
- errname | ||
- errorlint | ||
- exhaustive | ||
- exportloopref | ||
- gci | ||
- gocheckcompilerdirectives | ||
- gocognit | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- godot | ||
- gofmt | ||
- gofumpt | ||
- goimports | ||
- goprintffuncname | ||
- gosec | ||
- mirror | ||
- misspell | ||
- nakedret | ||
- nilerr | ||
- noctx | ||
- nolintlint | ||
- revive | ||
- rowserrcheck | ||
- sqlclosecheck | ||
- stylecheck | ||
- tenv | ||
- typecheck | ||
- unconvert | ||
- wastedassign | ||
- whitespace | ||
|
||
linters-settings: | ||
# A default case ensures we have checked everything. We should not require | ||
# every enum to be checked if we want to default. | ||
exhaustive: | ||
default-signifies-exhaustive: true | ||
# We do not want to enforce every usage of fmt.Errorf to use %w. | ||
errorlint: | ||
errorf: false | ||
|
||
# If we want to opt out of a lint, we require an explanation. | ||
nolintlint: | ||
allow-leading-space: true | ||
allow-unused: false | ||
require-explanation: true | ||
require-specific: true | ||
# We do not want every usage of fmt.Errorf to use %w. | ||
errorlint: | ||
errorf: false | ||
|
||
# If gofumpt is run outside a module, it assumes Go 1.0 rather than the | ||
# latest Go. We always want the latest formatting. | ||
# | ||
# https://github.com/mvdan/gofumpt/issues/137 | ||
gofumpt: | ||
lang-version: "1.21" | ||
cyclop: | ||
max-complexity: 20 | ||
gocyclo: | ||
min-complexity: 30 | ||
gocognit: | ||
min-complexity: 30 | ||
gci: | ||
no-prefix-comments: true # no leading comment; we allow inline for nolint | ||
sections: | ||
- standard # stdlib | ||
- default # everything not std, not within cloudv2 | ||
- prefix(go.panda.dev/cloudv2) # non-apps (proto, pkg) | ||
- prefix(go.panda.dev/cloudv2/apps) | ||
# Gocritic is a meta linter that has very good lints, and most of the | ||
# experimental ones are very good too. There are only a few we want to opt | ||
# out of specifically. | ||
gocritic: | ||
enabled-tags: | ||
- diagnostic | ||
- experimental | ||
- opinionated | ||
- performance | ||
- style | ||
disabled-checks: | ||
- evalOrder | ||
- importShadow | ||
# disabled due to 1.18 failures | ||
- hugeParam | ||
- rangeValCopy | ||
- typeDefFirst | ||
- paramTypeCombine | ||
# Revive is yet another metalinter with a bunch of useful lints. The below | ||
# opts in to all the ones we would like to use. | ||
lang-version: "1.20" | ||
|
||
# Revive is yet another metalinter with a lot of useful lints. | ||
# The below opts in to all the ones we would like to use. | ||
revive: | ||
ignore-generated-header: true | ||
enable-all-rules: true | ||
severity: warning | ||
confidence: 0.7 | ||
error-code: 1 | ||
warning-code: 1 | ||
confidence: 0.8 | ||
error-code: 0 | ||
warning-code: 0 | ||
rules: | ||
- name: add-constant | ||
disabled: true | ||
- name: argument-limit | ||
disabled: true | ||
- name: banned-characters | ||
disabled: true | ||
- name: cognitive-complexity | ||
disabled: true | ||
- name: confusing-naming | ||
disabled: true | ||
- name: cyclomatic | ||
disabled: true | ||
- name: file-header | ||
disabled: true | ||
- name: flag-parameter | ||
disabled: true | ||
- name: function-result-limit | ||
disabled: true | ||
- name: function-length | ||
disabled: true | ||
- name: import-shadowing | ||
disabled: true | ||
- name: line-length-limit | ||
disabled: true | ||
- name: max-public-structs | ||
disabled: true | ||
- name: modifies-parameter | ||
disabled: true | ||
- name: nested-structs | ||
disabled: true | ||
- name: package-comments # https://github.com/mgechev/revive/issues/740; stylecheck's ST1000 is better | ||
disabled: true | ||
- name: redefines-builtin-id | ||
disabled: true | ||
- name: unhandled-error | ||
disabled: true | ||
- name: atomic | ||
- name: blank-imports | ||
- name: bool-literal-in-expr | ||
- name: call-to-gc | ||
- name: confusing-results | ||
- name: constant-logical-expr | ||
- name: context-as-argument | ||
- name: context-keys-type | ||
- name: defer | ||
- name: dot-imports | ||
- name: duplicated-imports | ||
- name: early-return | ||
- name: error-naming | ||
- name: error-return | ||
- name: error-strings | ||
- name: errorf | ||
- name: get-return | ||
- name: identical-branches | ||
- name: if-return | ||
- name: modifies-value-receiver | ||
- name: optimize-operands-order | ||
- name: package-comments | ||
disabled: true # disabling this in favor of https://github.com/redpanda-data/redpanda/issues/6340 | ||
- name: range | ||
- name: range-val-in-closure | ||
- name: receiver-naming | ||
- name: string-of-int | ||
- name: struct-tag | ||
- name: superfluous-else | ||
- name: time-equal | ||
- name: time-naming | ||
- name: unconditional-recursion | ||
- name: unnecessary-stmt | ||
- name: unreachable-code | ||
- name: unused-parameter | ||
- name: unused-receiver | ||
- name: useless-break | ||
- name: var-declaration | ||
- name: var-naming | ||
disabled: true | ||
- name: comment-spacings | ||
disabled: true | ||
- name: waitgroup-by-value |