go-latestver/.golangci.yml
Knut Ahlers 09e0a66976
Add PR testing, fix linter errors
Squashed commit of the following:

commit 2a83adf6c54d6abcf6762760fd38f2505511f545
Author: Knut Ahlers <knut@ahlers.me>
Date:   Wed Dec 1 03:34:49 2021 +0100

    Lint: Fix copylocks errors

    Signed-off-by: Knut Ahlers <knut@ahlers.me>

commit 418f85d504203a6968329e280ecd9cf7d2365373
Author: Knut Ahlers <knut@ahlers.me>
Date:   Wed Dec 1 03:31:38 2021 +0100

    Lint: Fix gosec warnings

    Signed-off-by: Knut Ahlers <knut@ahlers.me>

commit 1a977875740be3c40884aa0985578721ceb4ae37
Author: Knut Ahlers <knut@ahlers.me>
Date:   Wed Dec 1 03:28:02 2021 +0100

    Lint: Disable gomnd for certain cases

    Signed-off-by: Knut Ahlers <knut@ahlers.me>

commit 5e81cf79ba7256b321442530715a2b53de0a18e1
Author: Knut Ahlers <knut@ahlers.me>
Date:   Wed Dec 1 03:26:01 2021 +0100

    Lint: fix ineffassign errors

    Signed-off-by: Knut Ahlers <knut@ahlers.me>

commit cb14fae2dad985368e1f05d62f8e778817d01c6f
Author: Knut Ahlers <knut@ahlers.me>
Date:   Wed Dec 1 03:23:42 2021 +0100

    Lint: Fix revive linter errors

    Signed-off-by: Knut Ahlers <knut@ahlers.me>

commit b3390b8dff9b939caa4e3821a48dd848af0bfba4
Author: Knut Ahlers <knut@ahlers.me>
Date:   Wed Dec 1 03:21:35 2021 +0100

    Lint: Remove unrequired dereference

    Signed-off-by: Knut Ahlers <knut@ahlers.me>

commit f9052e6aa530c5b5017249fc6c31bdbb94252760
Author: Knut Ahlers <knut@ahlers.me>
Date:   Wed Dec 1 03:20:43 2021 +0100

    Lint: Remove deadcode

    Signed-off-by: Knut Ahlers <knut@ahlers.me>

commit 72b88adaa25a3bb5a7af21da7ed12f08cae36573
Author: Knut Ahlers <knut@ahlers.me>
Date:   Wed Dec 1 02:52:27 2021 +0100

    Add PR-testing

    Signed-off-by: Knut Ahlers <knut@ahlers.me>

Signed-off-by: Knut Ahlers <knut@ahlers.me>
2021-12-01 03:38:52 +01:00

69 lines
4.3 KiB
YAML

# Derived from https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
---
run:
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 5m
# Force readonly modules usage for checking
modules-download-mode: readonly
output:
format: tab
linters-settings:
forbidigo:
forbid:
- 'fmt\.Errorf' # Should use github.com/pkg/errors
funlen:
lines: 100
statements: 60
gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 15
gomnd:
settings:
mnd:
ignored-functions: 'strconv.(?:Format|Parse)\B+'
linters:
disable-all: true
enable:
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers [fast: true, auto-fix: false]
- bodyclose # checks whether HTTP response body is closed successfully [fast: true, auto-fix: false]
- deadcode # Finds unused code [fast: true, auto-fix: false]
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false]
- exportloopref # checks for pointers to enclosing loop variables [fast: true, auto-fix: false]
- forbidigo # Forbids identifiers [fast: true, auto-fix: false]
- funlen # Tool for detection of long functions [fast: true, auto-fix: false]
- gocognit # Computes and checks the cognitive complexity of functions [fast: true, auto-fix: false]
- goconst # Finds repeated strings that could be replaced by a constant [fast: true, auto-fix: false]
- gocritic # The most opinionated Go source code linter [fast: true, auto-fix: false]
- gocyclo # Computes and checks the cyclomatic complexity of functions [fast: true, auto-fix: false]
- godox # Tool for detection of FIXME, TODO and other comment keywords [fast: true, auto-fix: false]
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true]
- gofumpt # Gofumpt checks whether code was gofumpt-ed. [fast: true, auto-fix: true]
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports [fast: true, auto-fix: true]
- gomnd # An analyzer to detect magic numbers. [fast: true, auto-fix: false]
- gosec # Inspects source code for security problems [fast: true, auto-fix: false]
- gosimple # Linter for Go source code that specializes in simplifying a code [fast: true, auto-fix: false]
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: true, auto-fix: false]
- ineffassign # Detects when assignments to existing variables are not used [fast: true, auto-fix: false]
- misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true]
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false]
- noctx # noctx finds sending http request without context.Context [fast: true, auto-fix: false]
- nolintlint # Reports ill-formed or insufficient nolint directives [fast: true, auto-fix: false]
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint. [fast: false, auto-fix: false]
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: true, auto-fix: false]
- structcheck # Finds unused struct fields [fast: true, auto-fix: false]
- stylecheck # Stylecheck is a replacement for golint [fast: true, auto-fix: false]
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code [fast: true, auto-fix: false]
- unconvert # Remove unnecessary type conversions [fast: true, auto-fix: false]
- unused # Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]
- varcheck # Finds unused global variables and constants [fast: true, auto-fix: false]
...