mirror of
https://github.com/openshift/installer.git
synced 2026-02-05 06:46:36 +01:00
Create .golangci-lint-v2.yaml
This commit is contained in:
138
.golangci-lint-v2.yaml
Normal file
138
.golangci-lint-v2.yaml
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
version: "2"
|
||||||
|
run:
|
||||||
|
go: "1.24"
|
||||||
|
modules-download-mode: vendor
|
||||||
|
allow-parallel-runners: true
|
||||||
|
linters:
|
||||||
|
enable:
|
||||||
|
- asciicheck
|
||||||
|
- containedctx
|
||||||
|
- copyloopvar
|
||||||
|
- decorder
|
||||||
|
- dogsled
|
||||||
|
- errorlint
|
||||||
|
- goconst
|
||||||
|
- gocritic
|
||||||
|
- gocyclo
|
||||||
|
- godot
|
||||||
|
- gosec
|
||||||
|
- importas
|
||||||
|
- misspell
|
||||||
|
- nakedret
|
||||||
|
- prealloc
|
||||||
|
- predeclared
|
||||||
|
- revive
|
||||||
|
- staticcheck
|
||||||
|
- thelper
|
||||||
|
- unconvert
|
||||||
|
- whitespace
|
||||||
|
settings:
|
||||||
|
errcheck:
|
||||||
|
disable-default-exclusions: true
|
||||||
|
check-type-assertions: false
|
||||||
|
check-blank: true
|
||||||
|
exclude-functions:
|
||||||
|
- io/ioutil.ReadFile
|
||||||
|
- io.Copy(*bytes.Buffer)
|
||||||
|
- io.Copy(os.Stdout)
|
||||||
|
errorlint:
|
||||||
|
errorf: true
|
||||||
|
asserts: true
|
||||||
|
comparison: true
|
||||||
|
gosec:
|
||||||
|
excludes:
|
||||||
|
- G115
|
||||||
|
staticcheck:
|
||||||
|
checks:
|
||||||
|
# Default
|
||||||
|
- all
|
||||||
|
# Disable check for one at least one comment in a package
|
||||||
|
- -ST1000
|
||||||
|
# Disable quickfix checks
|
||||||
|
- -QF1001
|
||||||
|
- -QF1008
|
||||||
|
revive:
|
||||||
|
rules:
|
||||||
|
- name: blank-imports
|
||||||
|
- name: context-as-argument
|
||||||
|
- name: context-keys-type
|
||||||
|
- name: dot-imports
|
||||||
|
- name: error-return
|
||||||
|
- name: error-strings
|
||||||
|
- name: error-naming
|
||||||
|
- name: exported
|
||||||
|
- name: if-return
|
||||||
|
- name: increment-decrement
|
||||||
|
- name: var-naming
|
||||||
|
- name: var-declaration
|
||||||
|
- name: range
|
||||||
|
- name: receiver-naming
|
||||||
|
- name: time-naming
|
||||||
|
- name: unexported-return
|
||||||
|
- name: indent-error-flow
|
||||||
|
- name: errorf
|
||||||
|
- name: superfluous-else
|
||||||
|
- name: unreachable-code
|
||||||
|
- name: redefines-builtin-id
|
||||||
|
- name: bool-literal-in-expr
|
||||||
|
- name: constant-logical-expr
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
presets:
|
||||||
|
- common-false-positives
|
||||||
|
- legacy
|
||||||
|
- std-error-handling
|
||||||
|
rules:
|
||||||
|
- linters:
|
||||||
|
- goconst
|
||||||
|
path: _test\.go
|
||||||
|
paths:
|
||||||
|
- ^bin
|
||||||
|
- ^cluster-api
|
||||||
|
- ^data/data
|
||||||
|
- ^docs
|
||||||
|
- ^hack
|
||||||
|
- ^images
|
||||||
|
- ^scripts
|
||||||
|
- ^terraform
|
||||||
|
- ^upi
|
||||||
|
- ^pkg/asset/manifests/azure/stack/v1beta1
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
|
issues:
|
||||||
|
uniq-by-line: false
|
||||||
|
formatters:
|
||||||
|
enable:
|
||||||
|
- gofmt
|
||||||
|
- goimports
|
||||||
|
settings:
|
||||||
|
gci:
|
||||||
|
sections:
|
||||||
|
- standard
|
||||||
|
- default
|
||||||
|
- prefix(github.com/openshift)
|
||||||
|
- blank
|
||||||
|
custom-order: true
|
||||||
|
gofumpt:
|
||||||
|
module-path: github.com/openshift/installer
|
||||||
|
extra-rules: true
|
||||||
|
goimports:
|
||||||
|
local-prefixes:
|
||||||
|
- github.com/openshift
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
paths:
|
||||||
|
- ^bin
|
||||||
|
- ^cluster-api
|
||||||
|
- ^data/data
|
||||||
|
- ^docs
|
||||||
|
- ^hack
|
||||||
|
- ^images
|
||||||
|
- ^scripts
|
||||||
|
- ^terraform
|
||||||
|
- ^upi
|
||||||
|
- ^pkg/asset/manifests/azure/stack/v1beta1
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
284
.golangci.yaml
284
.golangci.yaml
@@ -1,129 +1,171 @@
|
|||||||
version: "2"
|
|
||||||
run:
|
run:
|
||||||
go: "1.24"
|
timeout: 20m
|
||||||
|
go: '1.24'
|
||||||
modules-download-mode: vendor
|
modules-download-mode: vendor
|
||||||
allow-parallel-runners: true
|
allow-parallel-runners: true
|
||||||
|
output:
|
||||||
|
print-linter-name: true
|
||||||
|
sort-results: true
|
||||||
linters:
|
linters:
|
||||||
enable:
|
enable:
|
||||||
- asciicheck
|
- asciicheck
|
||||||
- containedctx
|
- containedctx
|
||||||
- copyloopvar
|
- decorder
|
||||||
- decorder
|
- dogsled
|
||||||
- dogsled
|
- errcheck
|
||||||
- errorlint
|
- errorlint
|
||||||
- goconst
|
- copyloopvar
|
||||||
- gocritic
|
- goconst
|
||||||
- gocyclo
|
- gocritic
|
||||||
- godot
|
- gocyclo
|
||||||
- gosec
|
- godot
|
||||||
- importas
|
- gofmt
|
||||||
- misspell
|
- goimports
|
||||||
- nakedret
|
- gosec
|
||||||
- prealloc
|
- gosimple
|
||||||
- predeclared
|
- govet
|
||||||
- revive
|
- importas
|
||||||
- staticcheck
|
- ineffassign
|
||||||
- thelper
|
- misspell
|
||||||
- unconvert
|
- nakedret
|
||||||
- whitespace
|
- prealloc
|
||||||
settings:
|
- predeclared
|
||||||
errcheck:
|
- revive
|
||||||
disable-default-exclusions: true
|
- staticcheck
|
||||||
check-type-assertions: false
|
- stylecheck
|
||||||
check-blank: true
|
- thelper
|
||||||
exclude-functions:
|
- typecheck
|
||||||
- io/ioutil.ReadFile
|
- unconvert
|
||||||
- io.Copy(*bytes.Buffer)
|
- unused
|
||||||
- io.Copy(os.Stdout)
|
- whitespace
|
||||||
errorlint:
|
linters-settings:
|
||||||
errorf: true
|
gosec:
|
||||||
asserts: true
|
excludes:
|
||||||
comparison: true
|
# Potential integer overflow when converting between integer types
|
||||||
gosec:
|
- G115
|
||||||
excludes:
|
errcheck:
|
||||||
- G115
|
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
|
||||||
revive:
|
# Such cases aren't reported by default.
|
||||||
rules:
|
# Default: false
|
||||||
- name: blank-imports
|
check-type-assertions: false
|
||||||
- name: context-as-argument
|
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`.
|
||||||
- name: context-keys-type
|
# Such cases aren't reported by default.
|
||||||
- name: dot-imports
|
# Default: false
|
||||||
- name: error-return
|
check-blank: true
|
||||||
- name: error-strings
|
# DEPRECATED comma-separated list of pairs of the form pkg:regex
|
||||||
- name: error-naming
|
#
|
||||||
- name: exported
|
# the regex is used to ignore names within pkg. (default "fmt:.*").
|
||||||
- name: if-return
|
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
|
||||||
- name: increment-decrement
|
# ignore: fmt:.*,io/ioutil:^Read.*
|
||||||
- name: var-naming
|
# To disable the errcheck built-in exclude list.
|
||||||
- name: var-declaration
|
# See `-excludeonly` option in https://github.com/kisielk/errcheck#excluding-functions for details.
|
||||||
- name: range
|
# Default: false
|
||||||
- name: receiver-naming
|
disable-default-exclusions: true
|
||||||
- name: time-naming
|
# DEPRECATED use exclude-functions instead.
|
||||||
- name: unexported-return
|
#
|
||||||
- name: indent-error-flow
|
# Path to a file containing a list of functions to exclude from checking.
|
||||||
- name: errorf
|
# See https://github.com/kisielk/errcheck#excluding-functions for details.
|
||||||
- name: superfluous-else
|
# exclude: /path/to/file.txt
|
||||||
- name: unreachable-code
|
# List of functions to exclude from checking, where each entry is a single function to exclude.
|
||||||
- name: redefines-builtin-id
|
# See https://github.com/kisielk/errcheck#excluding-functions for details.
|
||||||
- name: bool-literal-in-expr
|
exclude-functions:
|
||||||
- name: constant-logical-expr
|
- io/ioutil.ReadFile
|
||||||
exclusions:
|
- io.Copy(*bytes.Buffer)
|
||||||
generated: lax
|
- io.Copy(os.Stdout)
|
||||||
presets:
|
errorlint:
|
||||||
- common-false-positives
|
# Check whether fmt.Errorf uses the %w verb for formatting errors.
|
||||||
- legacy
|
# See the https://github.com/polyfloyd/go-errorlint for caveats.
|
||||||
- std-error-handling
|
# Default: true
|
||||||
|
errorf: true
|
||||||
|
# Check for plain type assertions and type switches.
|
||||||
|
# Default: true
|
||||||
|
asserts: true
|
||||||
|
# Check for plain error comparisons.
|
||||||
|
# Default: true
|
||||||
|
comparison: true
|
||||||
|
gci:
|
||||||
|
# DEPRECATED: use `sections` and `prefix(github.com/org/project)` instead.
|
||||||
|
# local-prefixes: github.com/org/project
|
||||||
|
#
|
||||||
|
# Section configuration to compare against.
|
||||||
|
# Section names are case-insensitive and may contain parameters in ().
|
||||||
|
# The default order of sections is `standard > default > custom > blank > dot`,
|
||||||
|
# If `custom-order` is `true`, it follows the order of `sections` option.
|
||||||
|
# Default: ["standard", "default"]
|
||||||
|
sections:
|
||||||
|
- standard # Standard section: captures all standard packages.
|
||||||
|
- default # Default section: contains all imports that could not be matched to another section type.
|
||||||
|
- prefix(github.com/openshift) # Custom section: groups all imports with the specified Prefix.
|
||||||
|
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
|
||||||
|
# - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
|
||||||
|
# Skip generated files.
|
||||||
|
# Default: true
|
||||||
|
skip-generated: true
|
||||||
|
# Enable custom order of sections.
|
||||||
|
# If `true`, make the section order the same as the order of `sections`.
|
||||||
|
# Default: false
|
||||||
|
custom-order: true
|
||||||
|
gofumpt:
|
||||||
|
# Select the Go version to target.
|
||||||
|
# Default: "1.15"
|
||||||
|
# Deprecated: use the global `run.go` instead.
|
||||||
|
# lang-version: "1.17"
|
||||||
|
# Module path which contains the source code being formatted.
|
||||||
|
# Default: ""
|
||||||
|
module-path: github.com/openshift/installer
|
||||||
|
# Choose whether to use the extra rules.
|
||||||
|
# Default: false
|
||||||
|
extra-rules: true
|
||||||
|
goimports:
|
||||||
|
# Put imports beginning with prefix after 3rd-party packages.
|
||||||
|
# It's a comma-separated list of prefixes.
|
||||||
|
# Default: ""
|
||||||
|
local-prefixes: github.com/openshift
|
||||||
|
revive:
|
||||||
rules:
|
rules:
|
||||||
- linters:
|
# The following rules are recommended https://github.com/mgechev/revive#recommended-configuration
|
||||||
- goconst
|
- name: blank-imports
|
||||||
path: _test\.go
|
- name: context-as-argument
|
||||||
paths:
|
- name: context-keys-type
|
||||||
- ^bin
|
- name: dot-imports
|
||||||
- ^cluster-api
|
- name: error-return
|
||||||
- ^data/data
|
- name: error-strings
|
||||||
- ^docs
|
- name: error-naming
|
||||||
- ^hack
|
- name: exported
|
||||||
- ^images
|
- name: if-return
|
||||||
- ^scripts
|
- name: increment-decrement
|
||||||
- ^terraform
|
- name: var-naming
|
||||||
- ^upi
|
- name: var-declaration
|
||||||
- ^pkg/asset/manifests/azure/stack/v1beta1
|
- name: range
|
||||||
- third_party$
|
- name: receiver-naming
|
||||||
- builtin$
|
- name: time-naming
|
||||||
- examples$
|
- name: unexported-return
|
||||||
|
- name: indent-error-flow
|
||||||
|
- name: errorf
|
||||||
|
- name: superfluous-else
|
||||||
|
- name: unreachable-code
|
||||||
|
- name: redefines-builtin-id
|
||||||
|
- name: bool-literal-in-expr
|
||||||
|
- name: constant-logical-expr
|
||||||
|
gocyclo:
|
||||||
|
min-complexity: 45
|
||||||
issues:
|
issues:
|
||||||
|
include:
|
||||||
|
- EXC0012 # EXC0012 revive: issue about not having a comment on exported.
|
||||||
|
- EXC0014 # EXC0014 revive: issue about not having a comment in the right format.
|
||||||
|
exclude-rules:
|
||||||
|
- linters:
|
||||||
|
- goconst
|
||||||
|
path: _test\.go
|
||||||
|
exclude-dirs:
|
||||||
|
- ^bin
|
||||||
|
- ^cluster-api
|
||||||
|
- ^data/data
|
||||||
|
- ^docs
|
||||||
|
- ^hack
|
||||||
|
- ^images
|
||||||
|
- ^scripts
|
||||||
|
- ^terraform
|
||||||
|
- ^upi
|
||||||
|
- ^pkg/asset/manifests/azure/stack/v1beta1 # local copy of capi azurestack provider fork api
|
||||||
uniq-by-line: false
|
uniq-by-line: false
|
||||||
formatters:
|
|
||||||
enable:
|
|
||||||
- gofmt
|
|
||||||
- goimports
|
|
||||||
settings:
|
|
||||||
gci:
|
|
||||||
sections:
|
|
||||||
- standard
|
|
||||||
- default
|
|
||||||
- prefix(github.com/openshift)
|
|
||||||
- blank
|
|
||||||
custom-order: true
|
|
||||||
gofumpt:
|
|
||||||
module-path: github.com/openshift/installer
|
|
||||||
extra-rules: true
|
|
||||||
goimports:
|
|
||||||
local-prefixes:
|
|
||||||
- github.com/openshift
|
|
||||||
exclusions:
|
|
||||||
generated: lax
|
|
||||||
paths:
|
|
||||||
- ^bin
|
|
||||||
- ^cluster-api
|
|
||||||
- ^data/data
|
|
||||||
- ^docs
|
|
||||||
- ^hack
|
|
||||||
- ^images
|
|
||||||
- ^scripts
|
|
||||||
- ^terraform
|
|
||||||
- ^upi
|
|
||||||
- ^pkg/asset/manifests/azure/stack/v1beta1
|
|
||||||
- third_party$
|
|
||||||
- builtin$
|
|
||||||
- examples$
|
|
||||||
|
|||||||
Reference in New Issue
Block a user