[no-relnote] Migrate golangci-lint config to v2

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2025-04-02 14:02:11 +02:00
parent 47fc33ea9b
commit bee1969bbf
No known key found for this signature in database

View File

@ -1,43 +1,72 @@
run: # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
timeout: 10m # SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
version: "2"
linters: linters:
enable: enable:
- contextcheck - contextcheck
- gocritic - gocritic
- gofmt
- goimports
- gosec - gosec
- gosimple
- govet
- ineffassign
- misspell - misspell
- staticcheck
- unconvert - unconvert
exclusions:
linters-settings: generated: lax
goimports: presets:
local-prefixes: github.com/NVIDIA/nvidia-container-toolkit - comments
- common-false-positives
issues: - legacy
exclude: - std-error-handling
# The legacy hook relies on spec.Hooks.Prestart, which is deprecated as of the v1.2.0 OCI runtime spec. rules:
- "SA1019:(.+).Prestart is deprecated(.+)"
# TODO: We should address each of the following integer overflows.
- "G115: integer overflow conversion(.+)"
exclude-rules:
# Exclude the gocritic dupSubExpr issue for cgo files. # Exclude the gocritic dupSubExpr issue for cgo files.
- path: internal/dxcore/dxcore.go - linters:
linters:
- gocritic - gocritic
path: internal/dxcore/dxcore.go
text: dupSubExpr text: dupSubExpr
# Exclude the checks for usage of returns to config.Delete(Path) in the crio and containerd config packages. # Exclude the checks for usage of returns to config.Delete(Path) in the
- path: pkg/config/engine/ # crio and containerd config packages.
linters: - linters:
- errcheck - errcheck
path: pkg/config/engine/
text: config.Delete text: config.Delete
# RENDERD refers to the Render Device and not the past tense of render. # RENDERD refers to the Render Device and not the past tense of render.
- path: .*.go - linters:
linters:
- misspell - misspell
text: "`RENDERD` is a misspelling of `RENDERED`" path: .*.go
text: '`RENDERD` is a misspelling of `RENDERED`'
# The legacy hook relies on spec.Hooks.Prestart, which is deprecated as of
# the v1.2.0 OCI runtime spec.
- path: (.+)\.go$
text: SA1019:(.+).Prestart is deprecated(.+)
# TODO: We should address each of the following integer overflows.
- path: (.+)\.go$
text: 'G115: integer overflow conversion(.+)'
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
settings:
goimports:
local-prefixes:
- github.com/NVIDIA/nvidia-container-toolkit
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$