Skip to content

Commit ba1c2ce

Browse files
maratoriSeigeC
authored andcommitted
docs(linters): add defaults (golangci#2891)
1 parent 4bf64e4 commit ba1c2ce

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:
@@ -934,6 +956,7 @@ linters-settings:
934956
# Default: false
935957
no-extra-aliases: true
936958
# List of aliases
959+
# Default: []
937960
alias:
938961
# Using `servingv1` alias for `knative.dev/serving/pkg/apis/serving/v1` package.
939962
- pkg: knative.dev/serving/pkg/apis/serving/v1
@@ -1000,6 +1023,7 @@ linters-settings:
10001023
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
10011024
# Default is to use a neutral variety of English.
10021025
locale: US
1026+
# Default: []
10031027
ignore-words:
10041028
- someword
10051029

@@ -1015,7 +1039,7 @@ linters-settings:
10151039

10161040
nilnil:
10171041
# Checks that there is no simultaneous return of `nil` error and an invalid value.
1018-
# Default: ptr, func, iface, map, chan
1042+
# Default: ["ptr", "func", "iface", "map", "chan"]
10191043
checked-types:
10201044
- ptr
10211045
- func
@@ -1074,6 +1098,7 @@ linters-settings:
10741098
# Default: false
10751099
strict: true
10761100
# Please refer to https://github.com/yeya24/promlinter#usage for detailed usage.
1101+
# Default: []
10771102
disabled-linters:
10781103
- Help
10791104
- MetricUnits
@@ -1423,28 +1448,35 @@ linters-settings:
14231448
disabled: false
14241449

14251450
rowserrcheck:
1451+
# database/sql is always checked
1452+
# Default: []
14261453
packages:
14271454
- github.com/jmoiron/sqlx
14281455

14291456
staticcheck:
14301457
# Select the Go version to target.
1431-
# Default: 1.13
1458+
# Default: "1.13"
14321459
go: "1.15"
14331460
# https://staticcheck.io/docs/options#checks
1461+
# Default: ["*"]
14341462
checks: [ "all" ]
14351463

14361464
stylecheck:
14371465
# Select the Go version to target.
14381466
# Default: 1.13
14391467
go: "1.15"
14401468
# https://staticcheck.io/docs/options#checks
1469+
# Default: ["*"]
14411470
checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ]
14421471
# https://staticcheck.io/docs/options#dot_import_whitelist
1472+
# Default: ["github.com/mmcloughlin/avo/build", "github.com/mmcloughlin/avo/operand", "github.com/mmcloughlin/avo/reg"]
14431473
dot-import-whitelist:
14441474
- fmt
14451475
# https://staticcheck.io/docs/options#initialisms
1446-
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" ]
1476+
# 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"]
1477+
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" ]
14471478
# https://staticcheck.io/docs/options#http_status_code_whitelist
1479+
# Default: ["200", "400", "404", "500"]
14481480
http-status-code-whitelist: [ "200", "400", "404", "500" ]
14491481

14501482
tagliatelle:
@@ -1453,6 +1485,8 @@ linters-settings:
14531485
# Use the struct field name to check the name of the struct tag.
14541486
# Default: false
14551487
use-field-name: true
1488+
# `camel` is used for `json` and `yaml` (can be overridden)
1489+
# Default: {}
14561490
rules:
14571491
# Any struct tag type can be used.
14581492
# Support string case: `camel`, `pascal`, `kebab`, `snake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`
@@ -1465,11 +1499,13 @@ linters-settings:
14651499

14661500
tenv:
14671501
# The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
1468-
# By default, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
1502+
# Otherwise, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
1503+
# Default: false
14691504
all: false
14701505

14711506
testpackage:
1472-
# regexp pattern to skip files
1507+
# Regexp pattern to skip files.
1508+
# Default: "(export|internal)_test\\.go"
14731509
skip-regexp: (export|internal)_test\.go
14741510

14751511
thelper:
@@ -1564,6 +1600,7 @@ linters-settings:
15641600
# An array of strings that specify substrings of signatures to ignore.
15651601
# If this set, it will override the default set of ignored signatures.
15661602
# See https://github.com/tomarrell/wrapcheck#configuration for more information.
1603+
# Default: [".Errorf(", "errors.New(", "errors.Unwrap(", ".Wrap(", ".Wrapf(", ".WithMessage(", ".WithMessagef(", ".WithStack("]
15671604
ignoreSigs:
15681605
- .Errorf(
15691606
- errors.New(
@@ -1573,11 +1610,17 @@ linters-settings:
15731610
- .WithMessage(
15741611
- .WithMessagef(
15751612
- .WithStack(
1613+
# An array of strings that specify regular expressions of signatures to ignore.
1614+
# Default: []
15761615
ignoreSigRegexps:
15771616
- \.New.*Error\(
1617+
# An array of strings that specify globs of packages to ignore.
1618+
# Default: []
15781619
ignorePackageGlobs:
15791620
- encoding/*
15801621
- github.com/pkg/*
1622+
# An array of strings that specify regular expressions of interfaces to ignore.
1623+
# Default: []
15811624
ignoreInterfaceRegexps:
15821625
- ^(?i)c(?-i)ach(ing|e)
15831626

0 commit comments

Comments
 (0)