Skip to content

Commit d43e480

Browse files
authored
docs(linters): add defaults (#2891)
1 parent 153b407 commit d43e480

File tree

1 file changed

+52
-9
lines changed

1 file changed

+52
-9
lines changed

.golangci.reference.yml

+52-9
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ linters-settings:
122122

123123
cyclop:
124124
# The maximal code complexity to report.
125+
# Default: 10
125126
max-complexity: 10
126127
# The maximal average package complexity.
127128
# If it's higher than 0.0 (float) the check is enabled
@@ -284,26 +285,30 @@ linters-settings:
284285
# The struct packages have the form `example.com/package.ExampleStruct`.
285286
# The matching patterns can use matching syntax from https://pkg.go.dev/path#Match.
286287
# If this list is empty, all structs are tested.
288+
# Default: []
287289
struct-patterns:
288290
- '*.Test'
289291
- 'example.com/package.ExampleStruct'
290292

291293
exhaustruct:
292294
# List of regular expressions to match struct packages and names.
293295
# If this list is empty, all structs are tested.
296+
# Default: []
294297
include:
295298
- '.*\.Test'
296299
- 'example\.com/package\.ExampleStruct[\d]{1,2}'
297300
# List of regular expressions to exclude struct packages and names from check.
301+
# Default: []
298302
exclude:
299303
- 'cobra\.Command$'
300304

301305
forbidigo:
302306
# Forbid the following identifiers (list of regexp).
307+
# Default: ["^(fmt\\.Print(|f|ln)|print|println)$"]
303308
forbid:
304309
- ^print.*$
305310
- 'fmt\.Print.*'
306-
# Optionally put comments at the end of the regex, surrounded by `(# )?`
311+
# Optionally put comments at the end of the regex, surrounded by `(# )?`
307312
# Escape any special characters.
308313
- 'fmt\.Print.*(# Do not commit print statements\.)?'
309314
# Exclude godoc examples from forbidigo checks.
@@ -487,6 +492,7 @@ linters-settings:
487492
skipRecvDeref: false
488493
unnamedResult:
489494
# Whether to check exported functions.
495+
# Default: false
490496
checkExported: true
491497

492498
gocyclo:
@@ -499,6 +505,7 @@ linters-settings:
499505
# Default: declarations
500506
scope: toplevel
501507
# List of regexps for excluding particular comment lines from check.
508+
# Default: []
502509
exclude:
503510
# Exclude todo and fixme comments.
504511
- "^fixme:"
@@ -513,7 +520,7 @@ linters-settings:
513520
godox:
514521
# Report any comments starting with keywords, this is useful for TODO or FIXME comments that
515522
# might be left in the code accidentally and should be resolved before merging.
516-
# Default: TODO, BUG, and FIXME.
523+
# Default: ["TODO", "BUG", "FIXME"]
517524
keywords:
518525
- NOTE
519526
- OPTIMIZE # marks code that should be optimized before merging
@@ -526,11 +533,11 @@ linters-settings:
526533

527534
gofumpt:
528535
# Select the Go version to target.
529-
# Default: 1.15
536+
# Default: "1.15"
530537
lang-version: "1.17"
531538

532539
# Module path which contains the source code being formatted.
533-
# Default: empty string
540+
# Default: ""
534541
module-path: github.com/org/project
535542

536543
# Choose whether to use the extra rules.
@@ -540,6 +547,7 @@ linters-settings:
540547
goheader:
541548
# Supports two types 'const` and `regexp`.
542549
# Values can be used recursively.
550+
# Default: {}
543551
values:
544552
const:
545553
# Define here const type values in format k:v.
@@ -550,6 +558,7 @@ linters-settings:
550558
# for example:
551559
AUTHOR: .*@mycompany\.com
552560
# The template use for checking.
561+
# Default: ""
553562
template: |-
554563
# Put here copyright header template for source code files
555564
# For example:
@@ -571,11 +580,13 @@ linters-settings:
571580
# limitations under the License.
572581
# As alternative of directive 'template', you may put the path to file with the template source.
573582
# Useful if you need to load the template from a specific file.
583+
# Default: ""
574584
template-path: /path/to/my/template.tmpl
575585

576586
goimports:
577587
# Put imports beginning with prefix after 3rd-party packages.
578588
# It's a comma-separated list of prefixes.
589+
# Default: ""
579590
local-prefixes: github.com/org/project
580591

581592
golint:
@@ -585,6 +596,7 @@ linters-settings:
585596

586597
gomnd:
587598
# List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
599+
# Default: ["argument", "case", "condition", "operation", "return", "assign"]
588600
checks:
589601
- argument
590602
- case
@@ -595,22 +607,26 @@ linters-settings:
595607
# List of numbers to exclude from analysis.
596608
# The numbers should be written as string.
597609
# Values always ignored: "1", "1.0", "0" and "0.0"
610+
# Default: []
598611
ignored-numbers:
599612
- '0666'
600613
- '0755'
601614
- '42'
602615
# List of file patterns to exclude from analysis.
603616
# Values always ignored: `.+_test.go`
617+
# Default: []
604618
ignored-files:
605619
- 'magic1_.*.go'
606620
# List of function patterns to exclude from analysis.
607621
# Values always ignored: `time.Time`
622+
# Default: []
608623
ignored-functions:
609624
- 'math.*'
610625
- 'http.StatusText'
611626

612627
gomoddirectives:
613628
# Allow local `replace` directives.
629+
# Default: false
614630
replace-local: false
615631
# List of allowed `replace` directives.
616632
# Default: []
@@ -626,13 +642,16 @@ linters-settings:
626642
gomodguard:
627643
allowed:
628644
# List of allowed modules.
645+
# Default: []
629646
modules:
630647
- gopkg.in/yaml.v2
631648
# List of allowed module domains.
649+
# Default: []
632650
domains:
633651
- golang.org
634652
blocked:
635653
# List of blocked modules.
654+
# Default: []
636655
modules:
637656
# Blocked module.
638657
- github.com/uudashr/go-module:
@@ -642,6 +661,7 @@ linters-settings:
642661
# Reason why the recommended module should be used. (Optional)
643662
reason: "`mod` is the official go.mod parser library."
644663
# List of blocked module version constraints.
664+
# Default: []
645665
versions:
646666
# Blocked module with version constraint.
647667
- github.com/mitchellh/go-homedir:
@@ -650,13 +670,15 @@ linters-settings:
650670
# Reason why the version constraint exists. (Optional)
651671
reason: "testing if blocked version constraint works."
652672
# Set to true to raise lint issues for packages that are loaded from a local path via replace directive.
673+
# Default: false
653674
local_replace_directives: false
654675

655676
gosimple:
656677
# Select the Go version to target.
657678
# Default: 1.13
658679
go: "1.15"
659680
# https://staticcheck.io/docs/options#checks
681+
# Default: ["*"]
660682
checks: [ "all" ]
661683

662684
gosec:
@@ -909,6 +931,7 @@ linters-settings:
909931
# Default: false
910932
no-extra-aliases: true
911933
# List of aliases
934+
# Default: []
912935
alias:
913936
# Using `servingv1` alias for `knative.dev/serving/pkg/apis/serving/v1` package.
914937
- pkg: knative.dev/serving/pkg/apis/serving/v1
@@ -975,6 +998,7 @@ linters-settings:
975998
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
976999
# Default is to use a neutral variety of English.
9771000
locale: US
1001+
# Default: []
9781002
ignore-words:
9791003
- someword
9801004

@@ -990,7 +1014,7 @@ linters-settings:
9901014

9911015
nilnil:
9921016
# Checks that there is no simultaneous return of `nil` error and an invalid value.
993-
# Default: ptr, func, iface, map, chan
1017+
# Default: ["ptr", "func", "iface", "map", "chan"]
9941018
checked-types:
9951019
- ptr
9961020
- func
@@ -1049,6 +1073,7 @@ linters-settings:
10491073
# Default: false
10501074
strict: true
10511075
# Please refer to https://github.com/yeya24/promlinter#usage for detailed usage.
1076+
# Default: []
10521077
disabled-linters:
10531078
- Help
10541079
- MetricUnits
@@ -1398,28 +1423,35 @@ linters-settings:
13981423
disabled: false
13991424

14001425
rowserrcheck:
1426+
# database/sql is always checked
1427+
# Default: []
14011428
packages:
14021429
- github.com/jmoiron/sqlx
14031430

14041431
staticcheck:
14051432
# Select the Go version to target.
1406-
# Default: 1.13
1433+
# Default: "1.13"
14071434
go: "1.15"
14081435
# https://staticcheck.io/docs/options#checks
1436+
# Default: ["*"]
14091437
checks: [ "all" ]
14101438

14111439
stylecheck:
14121440
# Select the Go version to target.
14131441
# Default: 1.13
14141442
go: "1.15"
14151443
# https://staticcheck.io/docs/options#checks
1444+
# Default: ["*"]
14161445
checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ]
14171446
# https://staticcheck.io/docs/options#dot_import_whitelist
1447+
# Default: ["github.com/mmcloughlin/avo/build", "github.com/mmcloughlin/avo/operand", "github.com/mmcloughlin/avo/reg"]
14181448
dot-import-whitelist:
14191449
- fmt
14201450
# https://staticcheck.io/docs/options#initialisms
1421-
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" ]
1451+
# 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"]
1452+
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" ]
14221453
# https://staticcheck.io/docs/options#http_status_code_whitelist
1454+
# Default: ["200", "400", "404", "500"]
14231455
http-status-code-whitelist: [ "200", "400", "404", "500" ]
14241456

14251457
tagliatelle:
@@ -1428,6 +1460,8 @@ linters-settings:
14281460
# Use the struct field name to check the name of the struct tag.
14291461
# Default: false
14301462
use-field-name: true
1463+
# `camel` is used for `json` and `yaml` (can be overridden)
1464+
# Default: {}
14311465
rules:
14321466
# Any struct tag type can be used.
14331467
# Support string case: `camel`, `pascal`, `kebab`, `snake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`
@@ -1440,11 +1474,13 @@ linters-settings:
14401474

14411475
tenv:
14421476
# The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
1443-
# By default, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
1477+
# Otherwise, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
1478+
# Default: false
14441479
all: false
14451480

14461481
testpackage:
1447-
# regexp pattern to skip files
1482+
# Regexp pattern to skip files.
1483+
# Default: "(export|internal)_test\\.go"
14481484
skip-regexp: (export|internal)_test\.go
14491485

14501486
thelper:
@@ -1539,6 +1575,7 @@ linters-settings:
15391575
# An array of strings that specify substrings of signatures to ignore.
15401576
# If this set, it will override the default set of ignored signatures.
15411577
# See https://github.com/tomarrell/wrapcheck#configuration for more information.
1578+
# Default: [".Errorf(", "errors.New(", "errors.Unwrap(", ".Wrap(", ".Wrapf(", ".WithMessage(", ".WithMessagef(", ".WithStack("]
15421579
ignoreSigs:
15431580
- .Errorf(
15441581
- errors.New(
@@ -1548,11 +1585,17 @@ linters-settings:
15481585
- .WithMessage(
15491586
- .WithMessagef(
15501587
- .WithStack(
1588+
# An array of strings that specify regular expressions of signatures to ignore.
1589+
# Default: []
15511590
ignoreSigRegexps:
15521591
- \.New.*Error\(
1592+
# An array of strings that specify globs of packages to ignore.
1593+
# Default: []
15531594
ignorePackageGlobs:
15541595
- encoding/*
15551596
- github.com/pkg/*
1597+
# An array of strings that specify regular expressions of interfaces to ignore.
1598+
# Default: []
15561599
ignoreInterfaceRegexps:
15571600
- ^(?i)c(?-i)ach(ing|e)
15581601

0 commit comments

Comments
 (0)