11# Copyright (c) HashiCorp, Inc.
22# SPDX-License-Identifier: MPL-2.0
33
4+ version : " 2"
45linters :
5- disable-all : true
6+ default : none
67 enable :
78 # (TODO) uncomment after fixing the lint issues
89 # - gofmt
@@ -13,70 +14,73 @@ linters:
1314 # - unparam
1415 - forbidigo
1516
16- issues :
17- # Disable the default exclude list so that all excludes are explicitly
18- # defined in this file.
19- exclude-use-default : false
17+ settings :
18+ forbidigo :
19+ # Forbid the following identifiers (list of regexp).
20+ forbid :
21+ - pattern : ' \brequire\.New\b(# Use package-level functions with explicit TestingT)?'
22+ - pattern : ' \bassert\.New\b(# Use package-level functions with explicit TestingT)?'
23+ - pattern : ' \bmetrics\.IncrCounter\b(# Use labeled metrics)?'
24+ - pattern : ' \bmetrics\.AddSample\b(# Use labeled metrics)?'
25+ - pattern : ' \bmetrics\.MeasureSince\b(# Use labeled metrics)?'
26+ - pattern : ' \bmetrics\.SetGauge\b(# Use labeled metrics)?'
27+ # Expattern: clude godoc examples from forbidigo checks.
28+ # Default: true
29+ exclude-godoc-examples : false
2030
21- exclude-rules :
22- # Temp Ignore SA9004: only the first constant in this group has an explicit type
23- # https://staticcheck.io/docs/checks#SA9004
24- - linters : [staticcheck]
25- text : ' SA9004:'
31+ exclusions :
32+ rules :
33+ # Temp Ignore SA9004: only the first constant in this group has an explicit type
34+ # https://staticcheck.io/docs/checks#SA9004
35+ - linters : [staticcheck]
36+ text : " SA9004:"
2637
27- - linters : [staticcheck]
28- text : ' SA1019: Package github.com/golang/protobuf/jsonpb is deprecated'
38+ - linters : [staticcheck]
39+ text : " SA1019: Package github.com/golang/protobuf/jsonpb is deprecated"
2940
30- - linters : [staticcheck]
31- text : ' SA1019: Package github.com/golang/protobuf/proto is deprecated'
41+ - linters : [staticcheck]
42+ text : " SA1019: Package github.com/golang/protobuf/proto is deprecated"
3243
33- - linters : [staticcheck]
34- text : ' SA1019: ptypes.MarshalAny is deprecated'
44+ - linters : [staticcheck]
45+ text : " SA1019: ptypes.MarshalAny is deprecated"
3546
36- - linters : [staticcheck]
37- text : ' SA1019: ptypes.UnmarshalAny is deprecated'
47+ - linters : [staticcheck]
48+ text : " SA1019: ptypes.UnmarshalAny is deprecated"
3849
39- - linters : [staticcheck]
40- text : ' SA1019: package github.com/golang/protobuf/ptypes is deprecated'
50+ - linters : [staticcheck]
51+ text : " SA1019: package github.com/golang/protobuf/ptypes is deprecated"
4152
42- # An argument that always receives the same value is often not a problem.
43- - linters : [unparam]
44- text : ' always receives'
53+ # An argument that always receives the same value is often not a problem.
54+ - linters : [unparam]
55+ text : " always receives"
4556
46- # Often functions will implement an interface that returns an error without
47- # needing to return an error. Sometimes the error return value is unnecessary
48- # but a linter can not tell the difference.
49- - linters : [unparam]
50- text : ' result \d+ \(error\) is always nil'
57+ # Often functions will implement an interface that returns an error without
58+ # needing to return an error. Sometimes the error return value is unnecessary
59+ # but a linter can not tell the difference.
60+ - linters : [unparam]
61+ text : ' result \d+ \(error\) is always nil'
5162
52- # Allow unused parameters to start with an underscore. Arguments with a name
53- # of '_' are already ignored.
54- # Ignoring longer names that start with underscore allow for better
55- # self-documentation than a single underscore by itself. Underscore arguments
56- # should generally only be used when a function is implementing an interface.
57- - linters : [unparam]
58- text : ' `_[^`]*` is unused'
63+ # Allow unused parameters to start with an underscore. Arguments with a name
64+ # of '_' are already ignored.
65+ # Ignoring longer names that start with underscore allow for better
66+ # self-documentation than a single underscore by itself. Underscore arguments
67+ # should generally only be used when a function is implementing an interface.
68+ - linters : [unparam]
69+ text : " `_[^`]*` is unused"
5970
60- # Temp ignore some common unused parameters so that unparam can be added
61- # incrementally.
62- - linters : [unparam]
63- text : ' `(t|resp|req|entMeta)` is unused'
71+ # Temp ignore some common unused parameters so that unparam can be added
72+ # incrementally.
73+ - linters : [unparam]
74+ text : " `(t|resp|req|entMeta)` is unused"
6475
65- linters-settings :
66- gofmt :
67- simplify : true
68- forbidigo :
69- # Forbid the following identifiers (list of regexp).
70- forbid :
71- - ' \brequire\.New\b(# Use package-level functions with explicit TestingT)?'
72- - ' \bassert\.New\b(# Use package-level functions with explicit TestingT)?'
73- - ' \bmetrics\.IncrCounter\b(# Use labeled metrics)?'
74- - ' \bmetrics\.AddSample\b(# Use labeled metrics)?'
75- - ' \bmetrics\.MeasureSince\b(# Use labeled metrics)?'
76- - ' \bmetrics\.SetGauge\b(# Use labeled metrics)?'
77- # Exclude godoc examples from forbidigo checks.
78- # Default: true
79- exclude_godoc_examples : false
76+ formatters :
77+ enable :
78+ - gofmt
79+ settings :
80+ gofmt :
81+ # Simplify code: gofmt with `-s` option.
82+ # Default: true
83+ simplify : false
8084
8185run :
8286 timeout : 10m
0 commit comments