ci: switch to golangci-lint v2.0
The new configuration files were initially generated by `golangci-lint migrate`, when tweaked to minimize and simplify. golangci-lint v2 switches to a new version of staticcheck which shows much more warnings. Some of them were fixed by a few previous commits, and the rest of them are disabled. Also, golangci-extra was modified to include ALL staticcheck linters. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
702b726c21
commit
670d57ae83
|
@ -11,7 +11,7 @@ on:
|
||||||
permissions: read-all
|
permissions: read-all
|
||||||
|
|
||||||
env:
|
env:
|
||||||
LINT_VERSION: v1.64.8
|
LINT_VERSION: v2.0
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
codespell:
|
codespell:
|
||||||
|
@ -37,13 +37,13 @@ jobs:
|
||||||
sudo apt-get -qq update
|
sudo apt-get -qq update
|
||||||
sudo apt-get -qq install libseccomp-dev
|
sudo apt-get -qq install libseccomp-dev
|
||||||
- name: lint
|
- name: lint
|
||||||
uses: golangci/golangci-lint-action@v6
|
uses: golangci/golangci-lint-action@v7
|
||||||
with:
|
with:
|
||||||
version: "${{ env.LINT_VERSION }}"
|
version: "${{ env.LINT_VERSION }}"
|
||||||
args: --verbose
|
args: --verbose
|
||||||
# Extra linters, only checking new code from a pull request.
|
# Extra linters, only checking new code from a pull request.
|
||||||
- name: lint-extra
|
- name: lint-extra
|
||||||
uses: golangci/golangci-lint-action@v6
|
uses: golangci/golangci-lint-action@v7
|
||||||
with:
|
with:
|
||||||
args: --config=.golangci-extra.yml
|
args: --config=.golangci-extra.yml
|
||||||
version: "${{ env.LINT_VERSION }}"
|
version: "${{ env.LINT_VERSION }}"
|
||||||
|
|
|
@ -6,7 +6,10 @@
|
||||||
# The idea is to impose additional rules for newly added code only
|
# The idea is to impose additional rules for newly added code only
|
||||||
# (rules we can not realistically satisfy for existing code).
|
# (rules we can not realistically satisfy for existing code).
|
||||||
|
|
||||||
|
version: "2"
|
||||||
|
|
||||||
run:
|
run:
|
||||||
|
timeout: 5m
|
||||||
build-tags:
|
build-tags:
|
||||||
- apparmor
|
- apparmor
|
||||||
- seccomp
|
- seccomp
|
||||||
|
@ -14,9 +17,13 @@ run:
|
||||||
- systemd
|
- systemd
|
||||||
- exclude_graphdriver_btrfs
|
- exclude_graphdriver_btrfs
|
||||||
- containers_image_openpgp
|
- containers_image_openpgp
|
||||||
timeout: 5m
|
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
disable-all: true
|
default: none
|
||||||
enable:
|
enable:
|
||||||
- godot
|
- godot
|
||||||
|
- staticcheck
|
||||||
|
settings:
|
||||||
|
staticcheck:
|
||||||
|
checks:
|
||||||
|
- all
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
---
|
version: "2"
|
||||||
|
|
||||||
run:
|
run:
|
||||||
|
timeout: 5m
|
||||||
build-tags:
|
build-tags:
|
||||||
- apparmor
|
- apparmor
|
||||||
- seccomp
|
- seccomp
|
||||||
|
@ -8,7 +10,11 @@ run:
|
||||||
- exclude_graphdriver_btrfs
|
- exclude_graphdriver_btrfs
|
||||||
- containers_image_openpgp
|
- containers_image_openpgp
|
||||||
- cni
|
- cni
|
||||||
timeout: 5m
|
|
||||||
|
formatters:
|
||||||
|
enable:
|
||||||
|
- gofumpt
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
enable:
|
enable:
|
||||||
- asasalint
|
- asasalint
|
||||||
|
@ -30,7 +36,6 @@ linters:
|
||||||
- gocheckcompilerdirectives
|
- gocheckcompilerdirectives
|
||||||
- gochecksumtype
|
- gochecksumtype
|
||||||
- gocritic
|
- gocritic
|
||||||
- gofumpt
|
|
||||||
- goprintffuncname
|
- goprintffuncname
|
||||||
- gosmopolitan
|
- gosmopolitan
|
||||||
- iface
|
- iface
|
||||||
|
@ -53,31 +58,32 @@ linters:
|
||||||
- usetesting
|
- usetesting
|
||||||
- wastedassign
|
- wastedassign
|
||||||
- whitespace
|
- whitespace
|
||||||
|
settings:
|
||||||
linters-settings:
|
|
||||||
errcheck:
|
errcheck:
|
||||||
check-type-assertions: true
|
check-type-assertions: true
|
||||||
gocyclo:
|
gocyclo:
|
||||||
min-complexity: 35
|
min-complexity: 35
|
||||||
gofmt:
|
|
||||||
rewrite-rules:
|
|
||||||
- pattern: 'interface{}'
|
|
||||||
replacement: 'any'
|
|
||||||
revive:
|
revive:
|
||||||
rules:
|
rules:
|
||||||
- name: dot-imports
|
- name: dot-imports
|
||||||
disabled: true
|
disabled: true
|
||||||
|
staticcheck:
|
||||||
issues:
|
checks:
|
||||||
# Excluding configuration per-path, per-linter, per-text and per-source
|
- all
|
||||||
exclude-rules:
|
- -ST1003 # https://staticcheck.dev/docs/checks/#ST1003 Poorly chosen identifier.
|
||||||
# Exclude some linters from running on tests files.
|
- -QF1008 # https://staticcheck.dev/docs/checks/#QF1008 Omit embedded fields from selector expression.
|
||||||
- path: _test\.go
|
exclusions:
|
||||||
linters:
|
generated: strict
|
||||||
|
presets:
|
||||||
|
- comments
|
||||||
|
- common-false-positives
|
||||||
|
- std-error-handling
|
||||||
|
rules:
|
||||||
|
- linters:
|
||||||
- dupl
|
- dupl
|
||||||
- perfsprint
|
- perfsprint
|
||||||
# Exclude "should pass the context parameter" for libimage.LookupImage because of backward compatibility.
|
path: _test\.go
|
||||||
- path: "libimage"
|
- linters:
|
||||||
text: "LookupImage"
|
|
||||||
linters:
|
|
||||||
- contextcheck
|
- contextcheck
|
||||||
|
path: libimage
|
||||||
|
text: LookupImage
|
||||||
|
|
Loading…
Reference in New Issue