-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from 0xPolygon/CDK-348-golangci-lint-cdk-main-repo
build: add golang linter
- Loading branch information
Showing
1 changed file
with
77 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,77 @@ | ||
# This file configures github.com/golangci/golangci-lint. | ||
|
||
run: | ||
timeout: 3m | ||
tests: true | ||
# default is true. Enables skipping of directories: | ||
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ | ||
skip-dirs-use-default: true | ||
skip-dirs: | ||
- tests | ||
|
||
service: | ||
golangci-lint-version: 1.59.1 | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- whitespace # Tool for detection of leading and trailing whitespace | ||
- wsl # Forces you to use empty lines | ||
- wastedassign # Finds wasted assignment statements | ||
- unconvert # Unnecessary type conversions | ||
- tparallel # Detects inappropriate usage of t.Parallel() method in your Go test codes | ||
- thelper # Detects golang test helpers without t.Helper() call and checks the consistency of test helpers | ||
- stylecheck # Stylecheck is a replacement for golint | ||
- prealloc # Finds slice declarations that could potentially be pre-allocated | ||
- predeclared # Finds code that shadows one of Go's predeclared identifiers | ||
- nolintlint # Ill-formed or insufficient nolint directives | ||
- nlreturn # Checks for a new line before return and branch statements to increase code clarity | ||
- misspell # Misspelled English words in comments | ||
- makezero # Finds slice declarations with non-zero initial length | ||
- lll # Long lines | ||
- importas # Enforces consistent import aliases | ||
- gosec # Security problems | ||
- gofmt # Whether the code was gofmt-ed | ||
- goimports # Unused imports | ||
- goconst # Repeated strings that could be replaced by a constant | ||
- forcetypeassert # Finds forced type assertions | ||
- dogsled # Checks assignments with too many blank identifiers (e.g. x, , , _, := f()) | ||
- dupl # Code clone detection | ||
- errname # Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error | ||
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13 | ||
- gocritic | ||
- errcheck # Errcheck is a go lint rule for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases | ||
- godox # Godox is a linter for TODOs and FIXMEs left in the code | ||
|
||
linters-settings: | ||
gofmt: | ||
simplify: true | ||
goconst: | ||
min-len: 3 | ||
min-occurrences: 3 | ||
gocritic: | ||
enabled-checks: | ||
- ruleguard | ||
settings: | ||
ruleguard: | ||
rules: "./gorules/rules.go" | ||
|
||
issues: | ||
new-from-rev: origin/develop # report only new issues with reference to develop branch | ||
whole-files: true | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- gosec | ||
- unparam | ||
- lll | ||
- path: gen_sc_data\.go | ||
linters: | ||
- wsl | ||
- lll | ||
- stylecheck | ||
include: | ||
- EXC0012 # Exported (.+) should have comment( \(or a comment on this block\))? or be unexported | ||
- EXC0013 # Package comment should be of the form "(.+)... | ||
- EXC0014 # Comment on exported (.+) should be of the form "(.+)..." | ||
- EXC0015 # Should have a package comment |