This repository has been archived by the owner on Sep 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: golangci-linter config file (#28)
- Loading branch information
Showing
5 changed files
with
98 additions
and
26 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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
linters: | ||
enable-all: true | ||
disable: | ||
- scopelint # deprecated | ||
- maligned # deprecated | ||
- nosnakecase # deprecated | ||
- interfacer # deprecated | ||
- deadcode # deprecated | ||
- ifshort # deprecated | ||
- golint # deprecated | ||
- structcheck # deprecated | ||
- varcheck # deprecated | ||
- exhaustivestruct # deprecated | ||
- varnamelen | ||
- wrapcheck | ||
- paralleltest | ||
- interfacebloat | ||
- depguard | ||
- gochecknoglobals | ||
- gomnd | ||
- cyclop | ||
- nestif | ||
- gochecknoinits | ||
- dupl | ||
- goconst | ||
- gocognit # Consider to enable it | ||
- funlen # Consider to enable it | ||
- forbidigo # Consider to enable it | ||
- gci # Consider to enable it (add it to make fmt) | ||
- godox # Consider to enable it (only show warning) | ||
- gocritic # Consider to enable it | ||
- wsl # Consider to enable it | ||
- testpackage # Consider to enable it (??) | ||
- containedctx # Consider to enable it | ||
- contextcheck # Consider to enable it | ||
- exhaustive # Consider to enable it | ||
- exhaustruct # Consider to enable it | ||
- goerr113 # Consider to enable it | ||
- wastedassign # Consider to enable it | ||
- nonamedreturns # Consider to enable it | ||
- nlreturn # Consider to enable it | ||
- ireturn # Consider to enable it (??) | ||
|
||
linters-settings: | ||
gosimple: | ||
checks: ["all"] | ||
|
||
govet: | ||
enable-all: true | ||
disable: fieldalignment | ||
shadow: | ||
strict: true | ||
|
||
godox: | ||
severity: warning | ||
|
||
predeclared: | ||
# Comma-separated list of predeclared identifiers to not report on. | ||
# Default: "" | ||
ignore: "len" | ||
# Include method names and field names (i.e., qualified names) in checks. | ||
# Default: false | ||
q: true | ||
|
||
tagliatelle: | ||
# Check the struct tag name case. | ||
case: | ||
use-field-name: false | ||
rules: | ||
json: snake | ||
yaml: snake | ||
|
||
issues: | ||
exclude-rules: | ||
# disable funlen for all _test.go files | ||
- path: _test.go | ||
linters: | ||
- funlen | ||
|
||
- linters: | ||
- govet | ||
text: "shadow: declaration of \"err\" shadows" |
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,5 +1,11 @@ | ||
PACKAGES=$(shell go list ./... | grep -v 'tests') | ||
|
||
### Tools needed for development | ||
devtools: | ||
@echo "Installing devtools" | ||
go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
go install mvdan.cc/gofumpt@latest | ||
|
||
### Testing | ||
unit_test: | ||
go test $(PACKAGES) | ||
|
@@ -9,26 +15,8 @@ test: | |
|
||
### Formatting, linting, and vetting | ||
fmt: | ||
gofmt -s -w . | ||
gofumpt -l -w . | ||
go mod tidy | ||
|
||
check: | ||
golangci-lint run \ | ||
--build-tags "${BUILD_TAG}" \ | ||
--timeout=20m0s \ | ||
--enable=gofmt \ | ||
--enable=unconvert \ | ||
--enable=unparam \ | ||
--enable=asciicheck \ | ||
--enable=misspell \ | ||
--enable=revive \ | ||
--enable=decorder \ | ||
--enable=reassign \ | ||
--enable=usestdlibvars \ | ||
--enable=nilerr \ | ||
--enable=gosec \ | ||
--enable=exportloopref \ | ||
--enable=whitespace \ | ||
--enable=goimports \ | ||
--enable=gocyclo \ | ||
--enable=lll | ||
golangci-lint run --build-tags "${BUILD_TAG}" --timeout=20m0s |
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