Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup .golangci.yml #2097

Merged
merged 3 commits into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 40 additions & 18 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,42 @@
# https://golangci-lint.run/usage/configuration/
run:
timeout: 10m
# skip auto-generated files.
skip-files:
- ".*\\.pb\\.go$"
- ".*mock.*"

# Enables skipping of directories:
# - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
# Default: true
skip-dirs-use-default: false

# If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
# to go.mod are needed. This setting is most useful to check that go.mod does
# not need updates, such as in a continuous integration and testing system.
# If invoked with -mod=vendor, the go command assumes that the vendor
# directory holds the correct copies of dependencies and ignores
# the dependency descriptions in go.mod.
#
# Allowed values: readonly|vendor|mod
# By default, it isn't set.
modules-download-mode: readonly

output:
# Make issues output unique by line.
# Default: true
uniq-by-line: false

issues:
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
# Maximum issues count per one linter.
# Set to 0 to disable.
# Default: 50
max-issues-per-linter: 0

# Maximum count of issues with the same text.
# Set to 0 to disable.
# Default: 3
max-same-issues: 0

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- asciicheck
Expand All @@ -25,14 +49,17 @@ linters:
- forbidigo
- goconst
- gocritic
# - goerr113
- gofmt
- gofumpt
- goimports
# - gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
# - lll
- misspell
- nakedret
- noctx
Expand All @@ -47,13 +74,8 @@ linters:
- unused
- usestdlibvars
- whitespace
# - goerr113
# - gomnd
# - lll

linters-settings:
goimports:
local-prefixes: github.com/ava-labs/avalanchego
depguard:
rules:
packages:
Expand All @@ -69,7 +91,6 @@ linters-settings:
asserts: false
# Check for plain error comparisons.
comparison: false
# https://golangci-lint.run/usage/linters/#forbidigo
forbidigo:
# Forbid the following identifiers (list of regexp).
forbid:
Expand All @@ -78,11 +99,13 @@ linters-settings:
- 'require\.EqualValues$(# Equal should be used instead)?'
- 'require\.NotEqualValues$(# NotEqual should be used instead)?'
- '^(t|b|tb|f)\.(Fatal|Fatalf|Error|Errorf)$(# the require library should be used instead)?'
# Exclude godoc examples from forbidigo checks.
exclude_godoc_examples: false
# https://golangci-lint.run/usage/linters#gosec
goimports:
local-prefixes: github.com/ava-labs/avalanchego
gosec:
excludes:
- G107 # https://securego.io/docs/rules/g107.html
- G107 # Url provided to HTTP request as taint input https://securego.io/docs/rules/g107
revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr
Expand Down Expand Up @@ -126,9 +149,8 @@ linters-settings:
- name: useless-break
disabled: false
staticcheck:
go: "1.20"
# https://staticcheck.io/docs/options#checks
checks:
- "all"
- "-SA6002" # argument should be pointer-like to avoid allocation, for sync.Pool
- "-SA1019" # deprecated packages e.g., golang.org/x/crypto/ripemd160
- "-SA6002" # Storing non-pointer values in sync.Pool allocates memory
- "-SA1019" # Using a deprecated function, variable, constant or field
Loading