scorecard/.golangci.yml
Spencer Schrock d0cefa519a
🌱 enable the golangci-lint bugs preset (#3583)
* enable bugs preset

Signed-off-by: Spencer Schrock <sschrock@google.com>

* fix noctx linter

Signed-off-by: Spencer Schrock <sschrock@google.com>

* fix bodyclose linter

Signed-off-by: Spencer Schrock <sschrock@google.com>

* fix contextcheck linter

Signed-off-by: Spencer Schrock <sschrock@google.com>

* This ignores all existing cases of musttag linter complaints.

This analyzer seems useful in the future, but some of this code
is old and I don't want to change it for existing code now.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* ignore existing nilerr lints.

This behavior is from the initial commit, and primarily affects metrics.
Leaving as is, and hope to benefit from the linter in the future.

Signed-off-by: Spencer Schrock <sschrock@google.com>

---------

Signed-off-by: Spencer Schrock <sschrock@google.com>
2023-10-23 09:35:40 -07:00

146 lines
2.7 KiB
YAML

---
run:
concurrency: 6
timeout: 5m
issues:
# 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
new-from-rev: ""
exclude-rules:
- path: '(.+)_test\.go'
linters:
- funlen
- goconst
- gocyclo
skip-files:
- cron/data/request.pb.go # autogenerated
linters:
disable-all: true
enable:
- asciicheck
- dogsled
- errcheck
- errorlint
- exhaustive
- exportloopref
- gci
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- goerr113
- gofmt
- gofumpt
- goheader
- goimports
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- makezero
- misspell
- nakedret
- nestif
- predeclared
- staticcheck
- stylecheck
- thelper
- typecheck
- unconvert
- unused
- whitespace
- wrapcheck
presets:
- bugs
linters-settings:
errcheck:
check-type-assertions: true
check-blank: true
errorlint:
# TODO remove this when project migrates to golang 1.20
# https://golangci-lint.run/usage/linters/#errorlint
errorf-multi: false
exhaustive:
# https://golangci-lint.run/usage/linters/#exhaustive
default-signifies-exhaustive: true
govet:
enable:
- fieldalignment
godox:
keywords:
- BUG
- FIXME
- HACK
gci:
sections:
- standard
- default
- prefix(github.com/ossf/scorecard)
gocritic:
enabled-checks:
# Diagnostic
- appendAssign
- badCond
- caseOrder
- codegenComment
- commentedOutCode
- deprecatedComment
- dupBranchBody
- dupCase
- dupSubExpr
- exitAfterDefer
- flagName
- nilValReturn
- weakCond
- octalLiteral
# Performance
- appendCombine
- hugeParam
- rangeExprCopy
- rangeValCopy
# Style
- boolExprSimplify
- captLocal
- commentFormatting
- commentedOutImport
- defaultCaseOrder
- docStub
- elseif
- emptyFallthrough
- hexLiteral
- ifElseChain
- methodExprCall
- singleCaseSwitch
- typeAssertChain
- typeSwitchVar
- underef
- unlabelStmt
- unlambda
# Opinionated
- builtinShadow
- importShadow
- initClause
- nestingReduce
- paramTypeCombine
- ptrToRefParam
- typeUnparen
- unnecessaryBlock
wrapcheck:
ignorePackageGlobs:
- github.com/ossf/scorecard/v4/checks/fileparser