-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
204 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,204 @@ | ||
# Options for analysis running. | ||
run: | ||
timeout: 5m | ||
|
||
# The default concurrency value is the number of available CPU. | ||
concurrency: 4 | ||
|
||
# Exit code when at least one issue was found. | ||
# Default: 1 | ||
issues-exit-code: 1 | ||
|
||
# Include test files or not. | ||
# Default: true | ||
tests: false | ||
|
||
# Allow multiple parallel golangci-lint instances running. | ||
# If false (default) - golangci-lint acquires file lock on start. | ||
allow-parallel-runners: true | ||
|
||
skip-dirs: | ||
- test/testdata_etc # test files | ||
- internal/cache # extracted from Go code | ||
- internal/renameio # extracted from Go code | ||
- internal/robustio # extracted from Go code | ||
|
||
# Define the Go version limit. | ||
# Mainly related to generics support since go1.18. | ||
# Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.18 | ||
go: "1.20" | ||
|
||
# output configuration options | ||
output: | ||
# Format: colored-line-number|line-number|json|colored-tab|tab|checkstyle|code-climate|junit-xml|github-actions|teamcity | ||
Format: colored-line-number | ||
# Multiple can be specified by separating them by comma, output can be provided | ||
# for each of them by separating format name and path by colon symbol. | ||
# Output path can be either `stdout`, `stderr` or path to the file to write to. | ||
# Example: "checkstyle:report.xml,json:stdout,colored-line-number" | ||
# | ||
linters: | ||
disable-all: true | ||
enable: | ||
- bodyclose | ||
- depguard | ||
- dogsled | ||
- dupl | ||
- errcheck | ||
- exportloopref | ||
- funlen | ||
- gochecknoinits | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- gomnd | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- lll | ||
- nakedret | ||
- nlreturn | ||
- noctx | ||
- nolintlint | ||
- revive | ||
- staticcheck | ||
- stylecheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- whitespace | ||
- wrapcheck | ||
|
||
# don't enable: | ||
# - asciicheck | ||
# - scopelint | ||
# - gochecknoglobals | ||
# - gocognit | ||
# - godot | ||
# - godox | ||
# - goerr113 | ||
# - interfacer | ||
# - maligned | ||
# - nestif | ||
# - prealloc | ||
# - testpackage | ||
# - wsl | ||
|
||
linters-settings: | ||
nlreturn: | ||
# Size of the block (including return statement that is still "OK") | ||
# so no return split required. | ||
# Default: 1 | ||
block-size: 2 | ||
depguard: | ||
# new configuration | ||
rules: | ||
logger: | ||
deny: | ||
- pkg: "github.com/sirupsen/logrus" | ||
desc: logging is allowed only by github.com/rs/zerolog | ||
- pkg: "log" | ||
desc: logging is allowed only by github.com/rs/zerolog | ||
dupl: | ||
threshold: 100 | ||
funlen: | ||
lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. | ||
statements: 50 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 3 | ||
gocritic: | ||
enabled-tags: | ||
- diagnostic | ||
- experimental | ||
- opinionated | ||
- performance | ||
- style | ||
disabled-checks: | ||
- dupImport # https://github.com/go-critic/go-critic/issues/845 | ||
- ifElseChain | ||
- octalLiteral | ||
- whyNoLint | ||
- commentedOutCode | ||
gocyclo: | ||
min-complexity: 20 | ||
gofmt: | ||
rewrite-rules: | ||
- pattern: "interface{}" | ||
replacement: "any" | ||
- pattern: "a[b:len(a)]" | ||
replacement: "a[b:]" | ||
goimports: | ||
local-prefixes: github.com/golangci/golangci-lint | ||
gomnd: | ||
# don't include the "operation" and "assign" | ||
checks: | ||
- argument | ||
- case | ||
- condition | ||
- return | ||
ignored-numbers: | ||
- "0" | ||
- "1" | ||
- "2" | ||
- "3" | ||
ignored-functions: | ||
- strings.SplitN | ||
|
||
govet: | ||
disable: | ||
- sigchanyzer | ||
check-shadowing: true | ||
settings: | ||
printf: | ||
funcs: | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf | ||
lll: | ||
line-length: 140 | ||
nolintlint: | ||
allow-unused: false | ||
require-explanation: true | ||
require-specific: true | ||
revive: | ||
rules: | ||
- name: unexported-return | ||
disabled: true | ||
- name: unused-parameter | ||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#cyclomatic | ||
- name: cyclomatic | ||
severity: error | ||
disabled: false | ||
arguments: [20] | ||
|
||
issues: | ||
# Excluding configuration per-path, per-linter, per-text and per-source | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- gomnd | ||
|
||
- path: pkg/golinters/errcheck.go | ||
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" | ||
- path: pkg/commands/run.go | ||
text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" | ||
- path: pkg/commands/run.go | ||
text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." | ||
|
||
- path: pkg/golinters/gofumpt.go | ||
text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." | ||
- path: pkg/golinters/staticcheck_common.go | ||
text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." | ||
- path: pkg/lint/lintersdb/manager.go | ||
text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." | ||
- path: pkg/golinters/unused.go | ||
text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" | ||
- path: test/(fix|linters)_test.go | ||
text: "string `gocritic.go` has 3 occurrences, make it a constant" |