dev: clean configuration, documentation, and code (#1911)
* Remove dead code related to golangci.com * remove old build tags * stale bot: remove bug label from `exemptLabels` * order `gitignore` entries alphabetically * doc: order `linters-settings` alphabetically * remove obsolete exclude rule * release: add docs prefix to skip the commit in the changelog
This commit is contained in:
parent
93df6f75f5
commit
5d10450bc9
1
.github/stale.yml
vendored
1
.github/stale.yml
vendored
@ -8,7 +8,6 @@ daysUntilClose: 30
|
|||||||
exemptLabels:
|
exemptLabels:
|
||||||
- pinned
|
- pinned
|
||||||
- security
|
- security
|
||||||
- bug
|
|
||||||
- blocked
|
- blocked
|
||||||
- protected
|
- protected
|
||||||
- triaged
|
- triaged
|
||||||
|
2
.github/workflows/post-release.yml
vendored
2
.github/workflows/post-release.yml
vendored
@ -38,6 +38,6 @@ jobs:
|
|||||||
base: master
|
base: master
|
||||||
token: ${{ secrets.GOLANGCI_LINT_TOKEN }}
|
token: ${{ secrets.GOLANGCI_LINT_TOKEN }}
|
||||||
branch-suffix: timestamp
|
branch-suffix: timestamp
|
||||||
title: "Update documentation and assets"
|
title: "docs: Update documentation and assets"
|
||||||
team-reviewers: golangci/team
|
team-reviewers: golangci/team
|
||||||
delete-branch: true
|
delete-branch: true
|
||||||
|
14
.gitignore
vendored
14
.gitignore
vendored
@ -1,19 +1,19 @@
|
|||||||
/*.txt
|
*.test
|
||||||
|
.DS_Store
|
||||||
/*.pdf
|
/*.pdf
|
||||||
/*.pprof
|
/*.pprof
|
||||||
/dist/
|
/*.txt
|
||||||
/tools/dist/
|
|
||||||
/.idea/
|
/.idea/
|
||||||
/test/path
|
/.vscode/
|
||||||
|
/dist/
|
||||||
/golangci-lint
|
/golangci-lint
|
||||||
|
/test/path
|
||||||
/tools/Dracula.itermcolors
|
/tools/Dracula.itermcolors
|
||||||
|
/tools/dist/
|
||||||
/tools/godownloader
|
/tools/godownloader
|
||||||
/tools/goreleaser
|
/tools/goreleaser
|
||||||
/tools/node_modules
|
/tools/node_modules
|
||||||
/tools/svg-term
|
/tools/svg-term
|
||||||
/vendor/
|
/vendor/
|
||||||
/.vscode/
|
|
||||||
*.test
|
|
||||||
.DS_Store
|
|
||||||
coverage.out
|
coverage.out
|
||||||
coverage.xml
|
coverage.xml
|
@ -82,12 +82,23 @@ output:
|
|||||||
|
|
||||||
# all available settings of specific linters
|
# all available settings of specific linters
|
||||||
linters-settings:
|
linters-settings:
|
||||||
|
|
||||||
|
cyclop:
|
||||||
|
# the maximal code complexity to report
|
||||||
|
max-complexity: 10
|
||||||
|
# the maximal average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0)
|
||||||
|
package-average: 0.0
|
||||||
|
# should ignore tests (default false)
|
||||||
|
skip-tests: false
|
||||||
|
|
||||||
dogsled:
|
dogsled:
|
||||||
# checks assignments with too many blank identifiers; default is 2
|
# checks assignments with too many blank identifiers; default is 2
|
||||||
max-blank-identifiers: 2
|
max-blank-identifiers: 2
|
||||||
|
|
||||||
dupl:
|
dupl:
|
||||||
# tokens count to trigger issue, 150 by default
|
# tokens count to trigger issue, 150 by default
|
||||||
threshold: 100
|
threshold: 100
|
||||||
|
|
||||||
errcheck:
|
errcheck:
|
||||||
# report about not checking of errors in type assertions: `a := b.(MyStruct)`;
|
# report about not checking of errors in type assertions: `a := b.(MyStruct)`;
|
||||||
# default is false: such cases aren't reported by default.
|
# default is false: such cases aren't reported by default.
|
||||||
@ -105,6 +116,11 @@ linters-settings:
|
|||||||
# path to a file containing a list of functions to exclude from checking
|
# path to a file containing a list of functions to exclude from checking
|
||||||
# see https://github.com/kisielk/errcheck#excluding-functions for details
|
# see https://github.com/kisielk/errcheck#excluding-functions for details
|
||||||
exclude: /path/to/file.txt
|
exclude: /path/to/file.txt
|
||||||
|
|
||||||
|
errorlint:
|
||||||
|
# Report non-wrapping error creation using fmt.Errorf
|
||||||
|
errorf: true
|
||||||
|
|
||||||
exhaustive:
|
exhaustive:
|
||||||
# check switch statements in generated files also
|
# check switch statements in generated files also
|
||||||
check-generated: false
|
check-generated: false
|
||||||
@ -112,31 +128,47 @@ linters-settings:
|
|||||||
# 'default' case is present, even if all enum members aren't listed in the
|
# 'default' case is present, even if all enum members aren't listed in the
|
||||||
# switch
|
# switch
|
||||||
default-signifies-exhaustive: false
|
default-signifies-exhaustive: false
|
||||||
|
|
||||||
exhaustivestruct:
|
exhaustivestruct:
|
||||||
struct-patterns:
|
struct-patterns:
|
||||||
- '*.Test'
|
- '*.Test'
|
||||||
- '*.Test2'
|
- '*.Test2'
|
||||||
- '*.Embedded'
|
- '*.Embedded'
|
||||||
- '*.External'
|
- '*.External'
|
||||||
|
|
||||||
|
forbidigo:
|
||||||
|
# Forbid the following identifiers
|
||||||
|
forbid:
|
||||||
|
- fmt.Errorf # consider errors.Errorf in github.com/pkg/errors
|
||||||
|
- fmt.Print.* # too much log noise
|
||||||
|
- ginkgo\\.F.* # these are used just for local development
|
||||||
|
# Exclude godoc examples from forbidigo checks. Default is true.
|
||||||
|
exclude_godoc_examples: false
|
||||||
|
|
||||||
funlen:
|
funlen:
|
||||||
lines: 60
|
lines: 60
|
||||||
statements: 40
|
statements: 40
|
||||||
|
|
||||||
gci:
|
gci:
|
||||||
# put imports beginning with prefix after 3rd-party packages;
|
# put imports beginning with prefix after 3rd-party packages;
|
||||||
# only support one prefix
|
# only support one prefix
|
||||||
# if not set, use goimports.local-prefixes
|
# if not set, use goimports.local-prefixes
|
||||||
local-prefixes: github.com/org/project
|
local-prefixes: github.com/org/project
|
||||||
|
|
||||||
gocognit:
|
gocognit:
|
||||||
# minimal code complexity to report, 30 by default (but we recommend 10-20)
|
# minimal code complexity to report, 30 by default (but we recommend 10-20)
|
||||||
min-complexity: 10
|
min-complexity: 10
|
||||||
|
|
||||||
nestif:
|
nestif:
|
||||||
# minimal complexity of if statements to report, 5 by default
|
# minimal complexity of if statements to report, 5 by default
|
||||||
min-complexity: 4
|
min-complexity: 4
|
||||||
|
|
||||||
goconst:
|
goconst:
|
||||||
# minimal length of string constant, 3 by default
|
# minimal length of string constant, 3 by default
|
||||||
min-len: 3
|
min-len: 3
|
||||||
# minimal occurrences count to trigger, 3 by default
|
# minimal occurrences count to trigger, 3 by default
|
||||||
min-occurrences: 3
|
min-occurrences: 3
|
||||||
|
|
||||||
gocritic:
|
gocritic:
|
||||||
# Which checks should be enabled; can't be combined with 'disabled-checks';
|
# Which checks should be enabled; can't be combined with 'disabled-checks';
|
||||||
# See https://go-critic.github.io/overview#checks-overview
|
# See https://go-critic.github.io/overview#checks-overview
|
||||||
@ -194,17 +226,11 @@ linters-settings:
|
|||||||
unnamedResult:
|
unnamedResult:
|
||||||
# whether to check exported functions
|
# whether to check exported functions
|
||||||
checkExported: true
|
checkExported: true
|
||||||
|
|
||||||
gocyclo:
|
gocyclo:
|
||||||
# minimal code complexity to report, 30 by default (but we recommend 10-20)
|
# minimal code complexity to report, 30 by default (but we recommend 10-20)
|
||||||
min-complexity: 10
|
min-complexity: 10
|
||||||
|
|
||||||
cyclop:
|
|
||||||
# the maximal code complexity to report
|
|
||||||
max-complexity: 10
|
|
||||||
# the maximal average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0)
|
|
||||||
package-average: 0.0
|
|
||||||
# should ignore tests (default false)
|
|
||||||
skip-tests: false
|
|
||||||
godot:
|
godot:
|
||||||
# comments to be checked: `declarations`, `toplevel`, or `all`
|
# comments to be checked: `declarations`, `toplevel`, or `all`
|
||||||
scope: declarations
|
scope: declarations
|
||||||
@ -214,6 +240,7 @@ linters-settings:
|
|||||||
# - '[0-9]+'
|
# - '[0-9]+'
|
||||||
# check that each sentence starts with a capital letter
|
# check that each sentence starts with a capital letter
|
||||||
capital: false
|
capital: false
|
||||||
|
|
||||||
godox:
|
godox:
|
||||||
# report any comments starting with keywords, this is useful for TODO or FIXME comments that
|
# report any comments starting with keywords, this is useful for TODO or FIXME comments that
|
||||||
# might be left in the code accidentally and should be resolved before merging
|
# might be left in the code accidentally and should be resolved before merging
|
||||||
@ -221,9 +248,16 @@ linters-settings:
|
|||||||
- NOTE
|
- NOTE
|
||||||
- OPTIMIZE # marks code that should be optimized before merging
|
- OPTIMIZE # marks code that should be optimized before merging
|
||||||
- HACK # marks hack-arounds that should be removed before merging
|
- HACK # marks hack-arounds that should be removed before merging
|
||||||
|
|
||||||
gofmt:
|
gofmt:
|
||||||
# simplify code: gofmt with `-s` option, true by default
|
# simplify code: gofmt with `-s` option, true by default
|
||||||
simplify: true
|
simplify: true
|
||||||
|
|
||||||
|
gofumpt:
|
||||||
|
# Choose whether or not to use the extra rules that are disabled
|
||||||
|
# by default
|
||||||
|
extra-rules: false
|
||||||
|
|
||||||
goheader:
|
goheader:
|
||||||
values:
|
values:
|
||||||
const:
|
const:
|
||||||
@ -252,13 +286,16 @@ linters-settings:
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
template-path:
|
template-path:
|
||||||
# also as alternative of directive 'template' you may put the path to file with the template source
|
# also as alternative of directive 'template' you may put the path to file with the template source
|
||||||
|
|
||||||
goimports:
|
goimports:
|
||||||
# put imports beginning with prefix after 3rd-party packages;
|
# put imports beginning with prefix after 3rd-party packages;
|
||||||
# it's a comma-separated list of prefixes
|
# it's a comma-separated list of prefixes
|
||||||
local-prefixes: github.com/org/project
|
local-prefixes: github.com/org/project
|
||||||
|
|
||||||
golint:
|
golint:
|
||||||
# minimal confidence for issues, default is 0.8
|
# minimal confidence for issues, default is 0.8
|
||||||
min-confidence: 0.8
|
min-confidence: 0.8
|
||||||
|
|
||||||
gomnd:
|
gomnd:
|
||||||
settings:
|
settings:
|
||||||
mnd:
|
mnd:
|
||||||
@ -267,6 +304,18 @@ linters-settings:
|
|||||||
# ignored-numbers: 1000
|
# ignored-numbers: 1000
|
||||||
# ignored-files: magic_.*.go
|
# ignored-files: magic_.*.go
|
||||||
# ignored-functions: math.*
|
# ignored-functions: math.*
|
||||||
|
|
||||||
|
gomoddirectives:
|
||||||
|
# Allow local `replace` directives. Default is false.
|
||||||
|
replace-local: false
|
||||||
|
# List of allowed `replace` directives. Default is empty.
|
||||||
|
replace-allow-list:
|
||||||
|
- launchpad.net/gocheck
|
||||||
|
# Allow to not explain why the version has been retracted in the `retract` directives. Default is false.
|
||||||
|
retract-allow-no-explanation: false
|
||||||
|
# Forbid the use of the `exclude` directives. Default is false.
|
||||||
|
exclude-forbidden: false
|
||||||
|
|
||||||
gomodguard:
|
gomodguard:
|
||||||
allowed:
|
allowed:
|
||||||
modules: # List of allowed modules
|
modules: # List of allowed modules
|
||||||
@ -284,6 +333,7 @@ linters-settings:
|
|||||||
# version: "< 1.1.0" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons
|
# version: "< 1.1.0" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons
|
||||||
# reason: "testing if blocked version constraint works." # Reason why the version constraint exists. (Optional)
|
# reason: "testing if blocked version constraint works." # Reason why the version constraint exists. (Optional)
|
||||||
local_replace_directives: false # Set to true to raise lint issues for packages that are loaded from a local path via replace directive
|
local_replace_directives: false # Set to true to raise lint issues for packages that are loaded from a local path via replace directive
|
||||||
|
|
||||||
govet:
|
govet:
|
||||||
# report about shadowed variables
|
# report about shadowed variables
|
||||||
check-shadowing: true
|
check-shadowing: true
|
||||||
@ -305,6 +355,7 @@ linters-settings:
|
|||||||
disable:
|
disable:
|
||||||
- shadow
|
- shadow
|
||||||
disable-all: false
|
disable-all: false
|
||||||
|
|
||||||
depguard:
|
depguard:
|
||||||
list-type: blacklist
|
list-type: blacklist
|
||||||
include-go-root: false
|
include-go-root: false
|
||||||
@ -313,21 +364,39 @@ linters-settings:
|
|||||||
packages-with-error-message:
|
packages-with-error-message:
|
||||||
# specify an error message to output when a blacklisted package is used
|
# specify an error message to output when a blacklisted package is used
|
||||||
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
|
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
|
||||||
|
|
||||||
ifshort:
|
ifshort:
|
||||||
# Maximum length of variable declaration measured in number of lines, after which linter won't suggest using short syntax.
|
# Maximum length of variable declaration measured in number of lines, after which linter won't suggest using short syntax.
|
||||||
# Has higher priority than max-decl-chars.
|
# Has higher priority than max-decl-chars.
|
||||||
max-decl-lines: 1
|
max-decl-lines: 1
|
||||||
# Maximum length of variable declaration measured in number of characters, after which linter won't suggest using short syntax.
|
# Maximum length of variable declaration measured in number of characters, after which linter won't suggest using short syntax.
|
||||||
max-decl-chars: 30
|
max-decl-chars: 30
|
||||||
|
|
||||||
|
importas:
|
||||||
|
# using `servingv1` alias for `knative.dev/serving/pkg/apis/serving/v1` package
|
||||||
|
servingv1: knative.dev/serving/pkg/apis/serving/v1
|
||||||
|
# using `autoscalingv1alpha1` alias for `knative.dev/serving/pkg/apis/autoscaling/v1alpha1` package
|
||||||
|
autoscalingv1alpha1: knative.dev/serving/pkg/apis/autoscaling/v1alpha1
|
||||||
|
# You can specify the package path by regular expression,
|
||||||
|
# and alias by regular expression expansion syntax like below.
|
||||||
|
# see https://github.com/julz/importas#use-regular-expression for details
|
||||||
|
"$1$2": 'knative.dev/serving/pkg/apis/(\w+)/(v[\w\d]+)'
|
||||||
|
|
||||||
lll:
|
lll:
|
||||||
# max line length, lines longer will be reported. Default is 120.
|
# max line length, lines longer will be reported. Default is 120.
|
||||||
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
|
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
|
||||||
line-length: 120
|
line-length: 120
|
||||||
# tab width in spaces. Default to 1.
|
# tab width in spaces. Default to 1.
|
||||||
tab-width: 1
|
tab-width: 1
|
||||||
|
|
||||||
|
makezero:
|
||||||
|
# Allow only slices initialized with a length of zero. Default is false.
|
||||||
|
always: false
|
||||||
|
|
||||||
maligned:
|
maligned:
|
||||||
# print struct with more effective memory layout or not, false by default
|
# print struct with more effective memory layout or not, false by default
|
||||||
suggest-new: true
|
suggest-new: true
|
||||||
|
|
||||||
misspell:
|
misspell:
|
||||||
# Correct spellings using locale preferences for US or UK.
|
# Correct spellings using locale preferences for US or UK.
|
||||||
# Default is to use a neutral variety of English.
|
# Default is to use a neutral variety of English.
|
||||||
@ -335,9 +404,11 @@ linters-settings:
|
|||||||
locale: US
|
locale: US
|
||||||
ignore-words:
|
ignore-words:
|
||||||
- someword
|
- someword
|
||||||
|
|
||||||
nakedret:
|
nakedret:
|
||||||
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
|
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
|
||||||
max-func-lines: 30
|
max-func-lines: 30
|
||||||
|
|
||||||
prealloc:
|
prealloc:
|
||||||
# XXX: we don't recommend using this linter before doing performance profiling.
|
# XXX: we don't recommend using this linter before doing performance profiling.
|
||||||
# For most programs usage of prealloc will be a premature optimization.
|
# For most programs usage of prealloc will be a premature optimization.
|
||||||
@ -347,6 +418,7 @@ linters-settings:
|
|||||||
simple: true
|
simple: true
|
||||||
range-loops: true # Report preallocation suggestions on range loops, true by default
|
range-loops: true # Report preallocation suggestions on range loops, true by default
|
||||||
for-loops: false # Report preallocation suggestions on for loops, false by default
|
for-loops: false # Report preallocation suggestions on for loops, false by default
|
||||||
|
|
||||||
promlinter:
|
promlinter:
|
||||||
# Promlinter cannot infer all metrics name in static analysis.
|
# Promlinter cannot infer all metrics name in static analysis.
|
||||||
# Enable strict mode will also include the errors caused by failing to parse the args.
|
# Enable strict mode will also include the errors caused by failing to parse the args.
|
||||||
@ -361,11 +433,13 @@ linters-settings:
|
|||||||
# - "ReservedChars"
|
# - "ReservedChars"
|
||||||
# - "CamelCase"
|
# - "CamelCase"
|
||||||
# - "lintUnitAbbreviations"
|
# - "lintUnitAbbreviations"
|
||||||
|
|
||||||
predeclared:
|
predeclared:
|
||||||
# comma-separated list of predeclared identifiers to not report on
|
# comma-separated list of predeclared identifiers to not report on
|
||||||
ignore: ""
|
ignore: ""
|
||||||
# include method names and field names (i.e., qualified names) in checks
|
# include method names and field names (i.e., qualified names) in checks
|
||||||
q: false
|
q: false
|
||||||
|
|
||||||
nolintlint:
|
nolintlint:
|
||||||
# Enable to ensure that nolint directives are all used. Default is true.
|
# Enable to ensure that nolint directives are all used. Default is true.
|
||||||
allow-unused: false
|
allow-unused: false
|
||||||
@ -377,9 +451,11 @@ linters-settings:
|
|||||||
require-explanation: true
|
require-explanation: true
|
||||||
# Enable to require nolint directives to mention the specific linter being suppressed. Default is false.
|
# Enable to require nolint directives to mention the specific linter being suppressed. Default is false.
|
||||||
require-specific: true
|
require-specific: true
|
||||||
|
|
||||||
rowserrcheck:
|
rowserrcheck:
|
||||||
packages:
|
packages:
|
||||||
- github.com/jmoiron/sqlx
|
- github.com/jmoiron/sqlx
|
||||||
|
-
|
||||||
revive:
|
revive:
|
||||||
# see https://github.com/mgechev/revive#available-rules for details.
|
# see https://github.com/mgechev/revive#available-rules for details.
|
||||||
ignore-generated-header: true
|
ignore-generated-header: true
|
||||||
@ -387,9 +463,26 @@ linters-settings:
|
|||||||
rules:
|
rules:
|
||||||
- name: indent-error-flow
|
- name: indent-error-flow
|
||||||
severity: warning
|
severity: warning
|
||||||
|
|
||||||
|
tagliatelle:
|
||||||
|
# check the struck tag name case
|
||||||
|
case:
|
||||||
|
# use the struct field name to check the name of the struct tag
|
||||||
|
use-field-name: true
|
||||||
|
rules:
|
||||||
|
# any struct tag type can be used.
|
||||||
|
# support string case: `camel`, `pascal`, `kebab`, `snake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`
|
||||||
|
json: camel
|
||||||
|
yaml: camel
|
||||||
|
xml: camel
|
||||||
|
bson: camel
|
||||||
|
avro: snake
|
||||||
|
mapstructure: kebab
|
||||||
|
|
||||||
testpackage:
|
testpackage:
|
||||||
# regexp pattern to skip files
|
# regexp pattern to skip files
|
||||||
skip-regexp: (export|internal)_test\.go
|
skip-regexp: (export|internal)_test\.go
|
||||||
|
|
||||||
thelper:
|
thelper:
|
||||||
# The following configurations enable all checks. It can be omitted because all checks are enabled by default.
|
# The following configurations enable all checks. It can be omitted because all checks are enabled by default.
|
||||||
# You can enable only required checks deleting unnecessary checks.
|
# You can enable only required checks deleting unnecessary checks.
|
||||||
@ -405,21 +498,25 @@ linters-settings:
|
|||||||
first: true
|
first: true
|
||||||
name: true
|
name: true
|
||||||
begin: true
|
begin: true
|
||||||
|
|
||||||
unparam:
|
unparam:
|
||||||
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
|
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
|
||||||
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
|
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
|
||||||
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
|
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
|
||||||
# with golangci-lint call it on a directory with the changed file.
|
# with golangci-lint call it on a directory with the changed file.
|
||||||
check-exported: false
|
check-exported: false
|
||||||
|
|
||||||
unused:
|
unused:
|
||||||
# treat code as a program (not a library) and report unused exported identifiers; default is false.
|
# treat code as a program (not a library) and report unused exported identifiers; default is false.
|
||||||
# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
|
# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
|
||||||
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
|
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
|
||||||
# with golangci-lint call it on a directory with the changed file.
|
# with golangci-lint call it on a directory with the changed file.
|
||||||
check-exported: false
|
check-exported: false
|
||||||
|
|
||||||
whitespace:
|
whitespace:
|
||||||
multi-if: false # Enforces newlines (or comments) after every multi-line if statement
|
multi-if: false # Enforces newlines (or comments) after every multi-line if statement
|
||||||
multi-func: false # Enforces newlines (or comments) after every multi-line function signature
|
multi-func: false # Enforces newlines (or comments) after every multi-line function signature
|
||||||
|
|
||||||
wsl:
|
wsl:
|
||||||
# If true append is only allowed to be cuddled if appending value is
|
# If true append is only allowed to be cuddled if appending value is
|
||||||
# matching variables, fields or types on line above. Default is true.
|
# matching variables, fields or types on line above. Default is true.
|
||||||
@ -441,57 +538,6 @@ linters-settings:
|
|||||||
force-err-cuddling: false
|
force-err-cuddling: false
|
||||||
# Allow leading comments to be separated with empty lines
|
# Allow leading comments to be separated with empty lines
|
||||||
allow-separated-leading-comment: false
|
allow-separated-leading-comment: false
|
||||||
gofumpt:
|
|
||||||
# Choose whether or not to use the extra rules that are disabled
|
|
||||||
# by default
|
|
||||||
extra-rules: false
|
|
||||||
errorlint:
|
|
||||||
# Report non-wrapping error creation using fmt.Errorf
|
|
||||||
errorf: true
|
|
||||||
makezero:
|
|
||||||
# Allow only slices initialized with a length of zero. Default is false.
|
|
||||||
always: false
|
|
||||||
forbidigo:
|
|
||||||
# Forbid the following identifiers
|
|
||||||
forbid:
|
|
||||||
- fmt.Errorf # consider errors.Errorf in github.com/pkg/errors
|
|
||||||
- fmt.Print.* # too much log noise
|
|
||||||
- ginkgo\\.F.* # these are used just for local development
|
|
||||||
# Exclude godoc examples from forbidigo checks. Default is true.
|
|
||||||
exclude_godoc_examples: false
|
|
||||||
importas:
|
|
||||||
# using `servingv1` alias for `knative.dev/serving/pkg/apis/serving/v1` package
|
|
||||||
servingv1: knative.dev/serving/pkg/apis/serving/v1
|
|
||||||
# using `autoscalingv1alpha1` alias for `knative.dev/serving/pkg/apis/autoscaling/v1alpha1` package
|
|
||||||
autoscalingv1alpha1: knative.dev/serving/pkg/apis/autoscaling/v1alpha1
|
|
||||||
# You can specify the package path by regular expression,
|
|
||||||
# and alias by regular expression expansion syntax like below.
|
|
||||||
# see https://github.com/julz/importas#use-regular-expression for details
|
|
||||||
"$1$2": 'knative.dev/serving/pkg/apis/(\w+)/(v[\w\d]+)'
|
|
||||||
gomoddirectives:
|
|
||||||
# Allow local `replace` directives. Default is false.
|
|
||||||
replace-local: false
|
|
||||||
# List of allowed `replace` directives. Default is empty.
|
|
||||||
replace-allow-list:
|
|
||||||
- launchpad.net/gocheck
|
|
||||||
# Allow to not explain why the version has been retracted in the `retract` directives. Default is false.
|
|
||||||
retract-allow-no-explanation: false
|
|
||||||
# Forbid the use of the `exclude` directives. Default is false.
|
|
||||||
exclude-forbidden: false
|
|
||||||
tagliatelle:
|
|
||||||
# check the struck tag name case
|
|
||||||
case:
|
|
||||||
# use the struct field name to check the name of the struct tag
|
|
||||||
use-field-name: true
|
|
||||||
rules:
|
|
||||||
# any struct tag type can be used.
|
|
||||||
# support string case: `camel`, `pascal`, `kebab`, `snake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`
|
|
||||||
json: camel
|
|
||||||
yaml: camel
|
|
||||||
xml: camel
|
|
||||||
bson: camel
|
|
||||||
avro: snake
|
|
||||||
mapstructure: kebab
|
|
||||||
|
|
||||||
# The custom section can be used to define linter plugins to be loaded at runtime. See README doc
|
# The custom section can be used to define linter plugins to be loaded at runtime. See README doc
|
||||||
# for more info.
|
# for more info.
|
||||||
|
@ -128,11 +128,6 @@ issues:
|
|||||||
linters:
|
linters:
|
||||||
- gomnd
|
- gomnd
|
||||||
|
|
||||||
# https://github.com/go-critic/go-critic/issues/926
|
|
||||||
- linters:
|
|
||||||
- gocritic
|
|
||||||
text: "unnecessaryDefer:"
|
|
||||||
|
|
||||||
run:
|
run:
|
||||||
skip-dirs:
|
skip-dirs:
|
||||||
- test/testdata_etc
|
- test/testdata_etc
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// +build go1.12
|
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -2,7 +2,6 @@ package lintersdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"plugin"
|
"plugin"
|
||||||
|
|
||||||
@ -497,7 +496,6 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
|
|||||||
WithURL("https://github.com/golangci/golangci-lint/blob/master/pkg/golinters/nolintlint/README.md"),
|
WithURL("https://github.com/golangci/golangci-lint/blob/master/pkg/golinters/nolintlint/README.md"),
|
||||||
}
|
}
|
||||||
|
|
||||||
isLocalRun := os.Getenv("GOLANGCI_COM_RUN") == ""
|
|
||||||
enabledByDefault := map[string]bool{
|
enabledByDefault := map[string]bool{
|
||||||
golinters.NewGovet(nil).Name(): true,
|
golinters.NewGovet(nil).Name(): true,
|
||||||
golinters.NewErrcheck().Name(): true,
|
golinters.NewErrcheck().Name(): true,
|
||||||
@ -508,9 +506,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
|
|||||||
golinters.NewVarcheck().Name(): true,
|
golinters.NewVarcheck().Name(): true,
|
||||||
golinters.NewIneffassign().Name(): true,
|
golinters.NewIneffassign().Name(): true,
|
||||||
golinters.NewDeadcode().Name(): true,
|
golinters.NewDeadcode().Name(): true,
|
||||||
|
golinters.NewTypecheck().Name(): true,
|
||||||
// don't typecheck for golangci.com: too many troubles
|
|
||||||
golinters.NewTypecheck().Name(): isLocalRun,
|
|
||||||
}
|
}
|
||||||
return enableLinterConfigs(lcs, func(lc *linter.Config) bool {
|
return enableLinterConfigs(lcs, func(lc *linter.Config) bool {
|
||||||
return enabledByDefault[lc.Name()]
|
return enabledByDefault[lc.Name()]
|
||||||
|
@ -3,7 +3,6 @@ package lint
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -194,24 +193,19 @@ func (r Runner) Run(ctx context.Context, linters []*linter.Config, lintCtx *lint
|
|||||||
defer sw.Print()
|
defer sw.Print()
|
||||||
|
|
||||||
var issues []result.Issue
|
var issues []result.Issue
|
||||||
var runErr error
|
|
||||||
for _, lc := range linters {
|
for _, lc := range linters {
|
||||||
lc := lc
|
lc := lc
|
||||||
sw.TrackStage(lc.Name(), func() {
|
sw.TrackStage(lc.Name(), func() {
|
||||||
linterIssues, err := r.runLinterSafe(ctx, lintCtx, lc)
|
linterIssues, err := r.runLinterSafe(ctx, lintCtx, lc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.Log.Warnf("Can't run linter %s: %v", lc.Linter.Name(), err)
|
r.Log.Warnf("Can't run linter %s: %v", lc.Linter.Name(), err)
|
||||||
if os.Getenv("GOLANGCI_COM_RUN") == "" {
|
|
||||||
// Don't stop all linters on one linter failure for golangci.com.
|
|
||||||
runErr = err
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
issues = append(issues, linterIssues...)
|
issues = append(issues, linterIssues...)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return r.processLintResults(issues), runErr
|
return r.processLintResults(issues), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Runner) processIssues(issues []result.Issue, sw *timeutils.Stopwatch, statPerProcessor map[string]processorStat) []result.Issue {
|
func (r *Runner) processIssues(issues []result.Issue, sw *timeutils.Stopwatch, statPerProcessor map[string]processorStat) []result.Issue {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user