diff options
-rw-r--r-- | .gitlab/ci/test.yml | 2 | ||||
-rw-r--r-- | .golangci.yml | 53 | ||||
-rw-r--r-- | Makefile.util.mk | 2 |
3 files changed, 40 insertions, 17 deletions
diff --git a/.gitlab/ci/test.yml b/.gitlab/ci/test.yml index 5c8e783b..4f6fd523 100644 --- a/.gitlab/ci/test.yml +++ b/.gitlab/ci/test.yml @@ -43,7 +43,7 @@ cover: code_quality: extends: .tests-common - image: golangci/golangci-lint:v1.44.0 + image: golangci/golangci-lint:v1.46.2 variables: REPORT_FILE: gl-code-quality-report.json LINT_FLAGS: "--color never --deadline 15m" diff --git a/.golangci.yml b/.golangci.yml index 795ee62b..7009afd9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -22,25 +22,50 @@ run: # the dependency descriptions in go.mod. modules-download-mode: readonly + # Define the Go version limit. + # Mainly related to generics support in go1.18. + # Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.17 + go: '1.17' + output: - format: colored-line-number - print-issued-lines: true - print-linter-name: true + # Make issues output unique by line. + # Default: true + uniq-by-line: false linters-settings: + gci: + # Section configuration to compare against. + # Section names are case-insensitive and may contain parameters in (). + # Default: ["standard", "default"] + sections: + - standard # Captures all standard packages if they do not match another section. + - default # Contains all imports that could not be matched to another section type. + - prefix(gitlab.com/gitlab-org/gitlab-pages) # Groups all imports with the specified Prefix. + + # Separators that should be present between sections. + # Default: ["newLine"] + section-separators: + - newLine gocyclo: + # Minimal code complexity to report. + # Default: 30 (but we recommend 10-20) min-complexity: 10 - govet: - check-shadowing: false - goconst: - min-len: 3 - min-occurrences: 3 goimports: local-prefixes: gitlab.com/gitlab-org/gitlab-pages - nolintlint: - # Disable to ensure that all nolint directives actually have an effect. + gosimple: + # Select the Go version to target. + # Default: 1.13 + go: "1.17" + govet: + # Enable all analyzers. # Default: false - allow-unused: false + enable-all: true + # Disable analyzers by name. + # Run `go tool vet help` to see all analyzers. + disable: + - shadow + - fieldalignment + nolintlint: # Enable to require an explanation of nonzero length after each nolint directive. # Default: false require-explanation: true @@ -50,9 +75,7 @@ linters-settings: staticcheck: # Select the Go version to target. # Default: 1.13 - go: "1.16" - # https://staticcheck.io/docs/options#checks - checks: [ "all" ] + go: "1.17" linters: disable-all: true @@ -90,7 +113,7 @@ issues: - bodyclose - gosec - goconst - - path: "internal/fixture/fixtures.go" + - path: internal/fixture/fixtures\.go linters: - gosec diff --git a/Makefile.util.mk b/Makefile.util.mk index a2eea8bf..5a196fe4 100644 --- a/Makefile.util.mk +++ b/Makefile.util.mk @@ -3,7 +3,7 @@ OUT_FORMAT ?= colored-line-number LINT_FLAGS ?= $(if $V,-v) REPORT_FILE ?= -GOLANGCI_VERSION=v1.44.0 +GOLANGCI_VERSION=v1.46.2 GOTESTSUM_VERSION=v1.7.0 COVERAGE_PACKAGES=$(shell (go list ./... | grep -v -e "test/acceptance" | tr "\n", "," | sed 's/\(.*\),/\1 /')) |