docs(linters): add defaults (#2891)

This commit is contained in:
Marat Reymers 2022-05-29 15:58:21 +03:00 committed by GitHub
parent 153b4072ad
commit d43e480ab5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,6 +122,7 @@ linters-settings:
cyclop: cyclop:
# The maximal code complexity to report. # The maximal code complexity to report.
# Default: 10
max-complexity: 10 max-complexity: 10
# The maximal average package complexity. # The maximal average package complexity.
# If it's higher than 0.0 (float) the check is enabled # If it's higher than 0.0 (float) the check is enabled
@ -284,6 +285,7 @@ linters-settings:
# The struct packages have the form `example.com/package.ExampleStruct`. # The struct packages have the form `example.com/package.ExampleStruct`.
# The matching patterns can use matching syntax from https://pkg.go.dev/path#Match. # The matching patterns can use matching syntax from https://pkg.go.dev/path#Match.
# If this list is empty, all structs are tested. # If this list is empty, all structs are tested.
# Default: []
struct-patterns: struct-patterns:
- '*.Test' - '*.Test'
- 'example.com/package.ExampleStruct' - 'example.com/package.ExampleStruct'
@ -291,19 +293,22 @@ linters-settings:
exhaustruct: exhaustruct:
# List of regular expressions to match struct packages and names. # List of regular expressions to match struct packages and names.
# If this list is empty, all structs are tested. # If this list is empty, all structs are tested.
# Default: []
include: include:
- '.*\.Test' - '.*\.Test'
- 'example\.com/package\.ExampleStruct[\d]{1,2}' - 'example\.com/package\.ExampleStruct[\d]{1,2}'
# List of regular expressions to exclude struct packages and names from check. # List of regular expressions to exclude struct packages and names from check.
# Default: []
exclude: exclude:
- 'cobra\.Command$' - 'cobra\.Command$'
forbidigo: forbidigo:
# Forbid the following identifiers (list of regexp). # Forbid the following identifiers (list of regexp).
# Default: ["^(fmt\\.Print(|f|ln)|print|println)$"]
forbid: forbid:
- ^print.*$ - ^print.*$
- 'fmt\.Print.*' - 'fmt\.Print.*'
# Optionally put comments at the end of the regex, surrounded by `(# )?` # Optionally put comments at the end of the regex, surrounded by `(# )?`
# Escape any special characters. # Escape any special characters.
- 'fmt\.Print.*(# Do not commit print statements\.)?' - 'fmt\.Print.*(# Do not commit print statements\.)?'
# Exclude godoc examples from forbidigo checks. # Exclude godoc examples from forbidigo checks.
@ -487,6 +492,7 @@ linters-settings:
skipRecvDeref: false skipRecvDeref: false
unnamedResult: unnamedResult:
# Whether to check exported functions. # Whether to check exported functions.
# Default: false
checkExported: true checkExported: true
gocyclo: gocyclo:
@ -499,6 +505,7 @@ linters-settings:
# Default: declarations # Default: declarations
scope: toplevel scope: toplevel
# List of regexps for excluding particular comment lines from check. # List of regexps for excluding particular comment lines from check.
# Default: []
exclude: exclude:
# Exclude todo and fixme comments. # Exclude todo and fixme comments.
- "^fixme:" - "^fixme:"
@ -513,7 +520,7 @@ linters-settings:
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.
# Default: TODO, BUG, and FIXME. # Default: ["TODO", "BUG", "FIXME"]
keywords: keywords:
- NOTE - NOTE
- OPTIMIZE # marks code that should be optimized before merging - OPTIMIZE # marks code that should be optimized before merging
@ -526,11 +533,11 @@ linters-settings:
gofumpt: gofumpt:
# Select the Go version to target. # Select the Go version to target.
# Default: 1.15 # Default: "1.15"
lang-version: "1.17" lang-version: "1.17"
# Module path which contains the source code being formatted. # Module path which contains the source code being formatted.
# Default: empty string # Default: ""
module-path: github.com/org/project module-path: github.com/org/project
# Choose whether to use the extra rules. # Choose whether to use the extra rules.
@ -540,6 +547,7 @@ linters-settings:
goheader: goheader:
# Supports two types 'const` and `regexp`. # Supports two types 'const` and `regexp`.
# Values can be used recursively. # Values can be used recursively.
# Default: {}
values: values:
const: const:
# Define here const type values in format k:v. # Define here const type values in format k:v.
@ -550,6 +558,7 @@ linters-settings:
# for example: # for example:
AUTHOR: .*@mycompany\.com AUTHOR: .*@mycompany\.com
# The template use for checking. # The template use for checking.
# Default: ""
template: |- template: |-
# Put here copyright header template for source code files # Put here copyright header template for source code files
# For example: # For example:
@ -571,11 +580,13 @@ linters-settings:
# limitations under the License. # limitations under the License.
# As alternative of directive 'template', you may put the path to file with the template source. # As alternative of directive 'template', you may put the path to file with the template source.
# Useful if you need to load the template from a specific file. # Useful if you need to load the template from a specific file.
# Default: ""
template-path: /path/to/my/template.tmpl template-path: /path/to/my/template.tmpl
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.
# Default: ""
local-prefixes: github.com/org/project local-prefixes: github.com/org/project
golint: golint:
@ -585,6 +596,7 @@ linters-settings:
gomnd: gomnd:
# List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description. # List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
# Default: ["argument", "case", "condition", "operation", "return", "assign"]
checks: checks:
- argument - argument
- case - case
@ -595,22 +607,26 @@ linters-settings:
# List of numbers to exclude from analysis. # List of numbers to exclude from analysis.
# The numbers should be written as string. # The numbers should be written as string.
# Values always ignored: "1", "1.0", "0" and "0.0" # Values always ignored: "1", "1.0", "0" and "0.0"
# Default: []
ignored-numbers: ignored-numbers:
- '0666' - '0666'
- '0755' - '0755'
- '42' - '42'
# List of file patterns to exclude from analysis. # List of file patterns to exclude from analysis.
# Values always ignored: `.+_test.go` # Values always ignored: `.+_test.go`
# Default: []
ignored-files: ignored-files:
- 'magic1_.*.go' - 'magic1_.*.go'
# List of function patterns to exclude from analysis. # List of function patterns to exclude from analysis.
# Values always ignored: `time.Time` # Values always ignored: `time.Time`
# Default: []
ignored-functions: ignored-functions:
- 'math.*' - 'math.*'
- 'http.StatusText' - 'http.StatusText'
gomoddirectives: gomoddirectives:
# Allow local `replace` directives. # Allow local `replace` directives.
# Default: false
replace-local: false replace-local: false
# List of allowed `replace` directives. # List of allowed `replace` directives.
# Default: [] # Default: []
@ -626,13 +642,16 @@ linters-settings:
gomodguard: gomodguard:
allowed: allowed:
# List of allowed modules. # List of allowed modules.
# Default: []
modules: modules:
- gopkg.in/yaml.v2 - gopkg.in/yaml.v2
# List of allowed module domains. # List of allowed module domains.
# Default: []
domains: domains:
- golang.org - golang.org
blocked: blocked:
# List of blocked modules. # List of blocked modules.
# Default: []
modules: modules:
# Blocked module. # Blocked module.
- github.com/uudashr/go-module: - github.com/uudashr/go-module:
@ -642,6 +661,7 @@ linters-settings:
# Reason why the recommended module should be used. (Optional) # Reason why the recommended module should be used. (Optional)
reason: "`mod` is the official go.mod parser library." reason: "`mod` is the official go.mod parser library."
# List of blocked module version constraints. # List of blocked module version constraints.
# Default: []
versions: versions:
# Blocked module with version constraint. # Blocked module with version constraint.
- github.com/mitchellh/go-homedir: - github.com/mitchellh/go-homedir:
@ -650,6 +670,7 @@ linters-settings:
# Reason why the version constraint exists. (Optional) # Reason why the version constraint exists. (Optional)
reason: "testing if blocked version constraint works." reason: "testing if blocked version constraint works."
# Set to true to raise lint issues for packages that are loaded from a local path via replace directive. # Set to true to raise lint issues for packages that are loaded from a local path via replace directive.
# Default: false
local_replace_directives: false local_replace_directives: false
gosimple: gosimple:
@ -657,6 +678,7 @@ linters-settings:
# Default: 1.13 # Default: 1.13
go: "1.15" go: "1.15"
# https://staticcheck.io/docs/options#checks # https://staticcheck.io/docs/options#checks
# Default: ["*"]
checks: [ "all" ] checks: [ "all" ]
gosec: gosec:
@ -909,6 +931,7 @@ linters-settings:
# Default: false # Default: false
no-extra-aliases: true no-extra-aliases: true
# List of aliases # List of aliases
# Default: []
alias: alias:
# Using `servingv1` alias for `knative.dev/serving/pkg/apis/serving/v1` package. # Using `servingv1` alias for `knative.dev/serving/pkg/apis/serving/v1` package.
- pkg: knative.dev/serving/pkg/apis/serving/v1 - pkg: knative.dev/serving/pkg/apis/serving/v1
@ -975,6 +998,7 @@ linters-settings:
# Setting locale to US will correct the British spelling of 'colour' to 'color'. # Setting locale to US will correct the British spelling of 'colour' to 'color'.
# Default is to use a neutral variety of English. # Default is to use a neutral variety of English.
locale: US locale: US
# Default: []
ignore-words: ignore-words:
- someword - someword
@ -990,7 +1014,7 @@ linters-settings:
nilnil: nilnil:
# Checks that there is no simultaneous return of `nil` error and an invalid value. # Checks that there is no simultaneous return of `nil` error and an invalid value.
# Default: ptr, func, iface, map, chan # Default: ["ptr", "func", "iface", "map", "chan"]
checked-types: checked-types:
- ptr - ptr
- func - func
@ -1049,6 +1073,7 @@ linters-settings:
# Default: false # Default: false
strict: true strict: true
# Please refer to https://github.com/yeya24/promlinter#usage for detailed usage. # Please refer to https://github.com/yeya24/promlinter#usage for detailed usage.
# Default: []
disabled-linters: disabled-linters:
- Help - Help
- MetricUnits - MetricUnits
@ -1398,14 +1423,17 @@ linters-settings:
disabled: false disabled: false
rowserrcheck: rowserrcheck:
# database/sql is always checked
# Default: []
packages: packages:
- github.com/jmoiron/sqlx - github.com/jmoiron/sqlx
staticcheck: staticcheck:
# Select the Go version to target. # Select the Go version to target.
# Default: 1.13 # Default: "1.13"
go: "1.15" go: "1.15"
# https://staticcheck.io/docs/options#checks # https://staticcheck.io/docs/options#checks
# Default: ["*"]
checks: [ "all" ] checks: [ "all" ]
stylecheck: stylecheck:
@ -1413,13 +1441,17 @@ linters-settings:
# Default: 1.13 # Default: 1.13
go: "1.15" go: "1.15"
# https://staticcheck.io/docs/options#checks # https://staticcheck.io/docs/options#checks
# Default: ["*"]
checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ] checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ]
# https://staticcheck.io/docs/options#dot_import_whitelist # https://staticcheck.io/docs/options#dot_import_whitelist
# Default: ["github.com/mmcloughlin/avo/build", "github.com/mmcloughlin/avo/operand", "github.com/mmcloughlin/avo/reg"]
dot-import-whitelist: dot-import-whitelist:
- fmt - fmt
# https://staticcheck.io/docs/options#initialisms # https://staticcheck.io/docs/options#initialisms
initialisms: [ "ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS" ] # Default: ["ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS"]
initialisms: [ "ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS" ]
# https://staticcheck.io/docs/options#http_status_code_whitelist # https://staticcheck.io/docs/options#http_status_code_whitelist
# Default: ["200", "400", "404", "500"]
http-status-code-whitelist: [ "200", "400", "404", "500" ] http-status-code-whitelist: [ "200", "400", "404", "500" ]
tagliatelle: tagliatelle:
@ -1428,6 +1460,8 @@ linters-settings:
# Use the struct field name to check the name of the struct tag. # Use the struct field name to check the name of the struct tag.
# Default: false # Default: false
use-field-name: true use-field-name: true
# `camel` is used for `json` and `yaml` (can be overridden)
# Default: {}
rules: rules:
# Any struct tag type can be used. # Any struct tag type can be used.
# Support string case: `camel`, `pascal`, `kebab`, `snake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower` # Support string case: `camel`, `pascal`, `kebab`, `snake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`
@ -1440,11 +1474,13 @@ linters-settings:
tenv: tenv:
# The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures. # The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
# By default, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked. # Otherwise, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
# Default: false
all: false all: false
testpackage: testpackage:
# regexp pattern to skip files # Regexp pattern to skip files.
# Default: "(export|internal)_test\\.go"
skip-regexp: (export|internal)_test\.go skip-regexp: (export|internal)_test\.go
thelper: thelper:
@ -1539,6 +1575,7 @@ linters-settings:
# An array of strings that specify substrings of signatures to ignore. # An array of strings that specify substrings of signatures to ignore.
# If this set, it will override the default set of ignored signatures. # If this set, it will override the default set of ignored signatures.
# See https://github.com/tomarrell/wrapcheck#configuration for more information. # See https://github.com/tomarrell/wrapcheck#configuration for more information.
# Default: [".Errorf(", "errors.New(", "errors.Unwrap(", ".Wrap(", ".Wrapf(", ".WithMessage(", ".WithMessagef(", ".WithStack("]
ignoreSigs: ignoreSigs:
- .Errorf( - .Errorf(
- errors.New( - errors.New(
@ -1548,11 +1585,17 @@ linters-settings:
- .WithMessage( - .WithMessage(
- .WithMessagef( - .WithMessagef(
- .WithStack( - .WithStack(
# An array of strings that specify regular expressions of signatures to ignore.
# Default: []
ignoreSigRegexps: ignoreSigRegexps:
- \.New.*Error\( - \.New.*Error\(
# An array of strings that specify globs of packages to ignore.
# Default: []
ignorePackageGlobs: ignorePackageGlobs:
- encoding/* - encoding/*
- github.com/pkg/* - github.com/pkg/*
# An array of strings that specify regular expressions of interfaces to ignore.
# Default: []
ignoreInterfaceRegexps: ignoreInterfaceRegexps:
- ^(?i)c(?-i)ach(ing|e) - ^(?i)c(?-i)ach(ing|e)