-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more robust
.golangci.yml
(#235)
- Loading branch information
1 parent
a50e553
commit 267a4d7
Showing
55 changed files
with
1,328 additions
and
1,106 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
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,67 +1,210 @@ | ||
# https://golangci-lint.run/usage/configuration/ | ||
run: | ||
timeout: 10m | ||
# skip auto-generated files. | ||
skip-files: | ||
- ".*\\.pb\\.go$" | ||
|
||
# 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 | ||
exclude: | ||
- "G114: Use of net/http serve function that has no support for setting timeouts" | ||
exclude-rules: | ||
# ref: https://github.com/dominikh/go-tools/issues/1365 | ||
- path: client/pchainclient.go | ||
linters: | ||
- unused | ||
|
||
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 | ||
- bodyclose | ||
- deadcode | ||
- depguard | ||
- dupword | ||
- errcheck | ||
- errorlint | ||
- exportloopref | ||
- forbidigo | ||
- gci | ||
- goconst | ||
- gocritic | ||
# - goerr113 | ||
- gofmt | ||
- gofumpt | ||
- goimports | ||
- revive | ||
# - gomnd | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- importas | ||
- ineffassign | ||
# - lll | ||
- misspell | ||
- nakedret | ||
- noctx | ||
- nolintlint | ||
- perfsprint | ||
- prealloc | ||
- predeclared | ||
- revive | ||
- spancheck | ||
- staticcheck | ||
- stylecheck | ||
- tagalign | ||
- testifylint | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- varcheck | ||
- unconvert | ||
- usestdlibvars | ||
- whitespace | ||
- staticcheck | ||
# - structcheck | ||
# - lll | ||
# - gomnd | ||
# - goprintffuncname | ||
# - interfacer | ||
# - typecheck | ||
# - goerr113 | ||
# - noctx | ||
|
||
linters-settings: | ||
depguard: | ||
rules: | ||
packages: | ||
deny: | ||
- pkg: "io/ioutil" | ||
desc: io/ioutil is deprecated. Use package io or os instead. | ||
- pkg: "github.com/stretchr/testify/assert" | ||
desc: github.com/stretchr/testify/require should be used instead. | ||
- pkg: "github.com/golang/mock/gomock" | ||
desc: go.uber.org/mock/gomock should be used instead. | ||
errorlint: | ||
# Check for plain type assertions and type switches. | ||
asserts: false | ||
# Check for plain error comparisons. | ||
comparison: false | ||
forbidigo: | ||
# Forbid the following identifiers (list of regexp). | ||
forbid: | ||
- 'require\.Error$(# ErrorIs should be used instead)?' | ||
- 'require\.ErrorContains$(# ErrorIs should be used instead)?' | ||
- '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 | ||
gci: | ||
sections: | ||
- standard | ||
- default | ||
- blank | ||
- dot | ||
- prefix(github.com/ava-labs/avalanche-rosetta) | ||
- alias | ||
skip-generated: true | ||
custom-order: true | ||
gosec: | ||
excludes: | ||
- G107 # Url provided to HTTP request as taint input https://securego.io/docs/rules/g107 | ||
importas: | ||
# Do not allow unaliased imports of aliased packages. | ||
no-unaliased: false | ||
# Do not allow non-required aliases. | ||
no-extra-aliases: false | ||
# List of aliases | ||
alias: | ||
- pkg: github.com/ava-labs/coreth/core/types | ||
alias: ethtypes | ||
- pkg: github.com/ethereum/go-ethereum/common | ||
alias: ethcommon | ||
- pkg: github.com/ava-labs/avalanche-rosetta/mapper/pchain | ||
alias: pmapper | ||
- pkg: github.com/ava-labs/avalanche-rosetta/mapper/cchainatomictx | ||
alias: cmapper | ||
- pkg: github.com/ava-labs/avalanchego/utils/constants | ||
alias: avaconstants | ||
revive: | ||
rules: | ||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr | ||
- name: bool-literal-in-expr | ||
disabled: false | ||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return | ||
- name: early-return | ||
disabled: false | ||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines | ||
- name: empty-lines | ||
disabled: false | ||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format | ||
- name: string-format | ||
disabled: false | ||
arguments: | ||
- ["fmt.Errorf[0]", "/.*%.*/", "no format directive, use errors.New instead"] | ||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag | ||
- name: struct-tag | ||
disabled: false | ||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-naming | ||
- name: unexported-naming | ||
disabled: false | ||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error | ||
- name: unhandled-error | ||
disabled: false | ||
arguments: | ||
- "fmt\\.Fprint" | ||
- "fmt\\.Fprintf" | ||
- "fmt\\.Print" | ||
- "fmt\\.Printf" | ||
- "fmt\\.Println" | ||
- "math/rand\\.Read" | ||
- "strings\\.Builder\\.WriteString" | ||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter | ||
- name: unused-parameter | ||
disabled: false | ||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-receiver | ||
- name: unused-receiver | ||
disabled: false | ||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break | ||
- name: useless-break | ||
disabled: false | ||
spancheck: | ||
# https://github.com/jjti/go-spancheck#checks | ||
checks: | ||
- end | ||
# - record-error # check that `span.RecordError(err)` is called when an error is returned | ||
# - set-status # check that `span.SetStatus(codes.Error, msg)` is called when an error is returned | ||
staticcheck: | ||
go: "1.21" | ||
# 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 | ||
tagalign: | ||
align: true | ||
sort: true | ||
strict: true | ||
order: | ||
- serialize | ||
testifylint: | ||
# Enable all checkers (https://github.com/Antonboom/testifylint#checkers). | ||
# Default: false | ||
enable-all: true | ||
# Disable checkers by name | ||
# (in addition to default | ||
# suite-thelper | ||
# ). | ||
disable: | ||
- go-require | ||
- float-compare |
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
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
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
Oops, something went wrong.