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