File tree 6 files changed +30
-8
lines changed
6 files changed +30
-8
lines changed Original file line number Diff line number Diff line change @@ -550,6 +550,15 @@ linters-settings:
550
550
multi-if : false # Enforces newlines (or comments) after every multi-line if statement
551
551
multi-func : false # Enforces newlines (or comments) after every multi-line function signature
552
552
553
+ wrapcheck :
554
+ ignoreSigs :
555
+ - .Errorf(
556
+ - errors.New(
557
+ - errors.Unwrap(
558
+ - .Wrap(
559
+ - .Wrapf(
560
+ - .WithMessage(
561
+
553
562
wsl :
554
563
# See https://github.com/bombsimon/wsl/blob/master/doc/configuration.md for
555
564
# documentation of available settings. These are the defaults for
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ require (
75
75
github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b
76
76
github.com/tetafro/godot v1.4.6
77
77
github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94
78
- github.com/tomarrell/wrapcheck v1.2 .0
78
+ github.com/tomarrell/wrapcheck/v2 v2.1 .0
79
79
github.com/tommy-muehle/go-mnd/v2 v2.3.2
80
80
github.com/ultraware/funlen v0.0.3
81
81
github.com/ultraware/whitespace v0.0.4
Original file line number Diff line number Diff line change @@ -130,6 +130,7 @@ type LintersSettings struct {
130
130
Unused StaticCheckSettings
131
131
Varcheck VarCheckSettings
132
132
Whitespace WhitespaceSettings
133
+ Wrapcheck WrapcheckSettings
133
134
WSL WSLSettings
134
135
135
136
Custom map [string ]CustomLinterSettings
@@ -430,6 +431,10 @@ type WhitespaceSettings struct {
430
431
MultiFunc bool `mapstructure:"multi-func"`
431
432
}
432
433
434
+ type WrapcheckSettings struct {
435
+ IgnoreSigs []string `mapstructure:"ignoreSigs"`
436
+ }
437
+
433
438
type WSLSettings struct {
434
439
StrictAppend bool `mapstructure:"strict-append"`
435
440
AllowAssignAndCallCuddle bool `mapstructure:"allow-assign-and-call"`
Original file line number Diff line number Diff line change 1
1
package golinters
2
2
3
3
import (
4
- "github.com/tomarrell/wrapcheck/wrapcheck"
4
+ "github.com/tomarrell/wrapcheck/v2/ wrapcheck"
5
5
"golang.org/x/tools/go/analysis"
6
6
7
+ "github.com/golangci/golangci-lint/pkg/config"
7
8
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
8
9
)
9
10
10
11
const wrapcheckName = "wrapcheck"
11
12
12
- func NewWrapcheck () * goanalysis.Linter {
13
+ func NewWrapcheck (cfg config.WrapcheckSettings ) * goanalysis.Linter {
14
+ c := wrapcheck .NewDefaultConfig ()
15
+ c .IgnoreSigs = cfg .IgnoreSigs
16
+
17
+ a := wrapcheck .NewAnalyzer (c )
18
+
13
19
return goanalysis .NewLinter (
14
20
wrapcheckName ,
15
- wrapcheck . Analyzer .Doc ,
16
- []* analysis.Analyzer {wrapcheck . Analyzer },
21
+ a .Doc ,
22
+ []* analysis.Analyzer {a },
17
23
nil ,
18
24
).WithLoadMode (goanalysis .LoadModeTypesInfo )
19
25
}
Original file line number Diff line number Diff line change @@ -117,6 +117,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
117
117
var staticcheckCfg * config.StaticCheckSettings
118
118
var stylecheckCfg * config.StaticCheckSettings
119
119
var unusedCfg * config.StaticCheckSettings
120
+ var wrapcheckCfg * config.WrapcheckSettings
120
121
121
122
if m .cfg != nil {
122
123
govetCfg = & m .cfg .LintersSettings .Govet
@@ -137,6 +138,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
137
138
staticcheckCfg = & m .cfg .LintersSettings .Staticcheck
138
139
stylecheckCfg = & m .cfg .LintersSettings .Stylecheck
139
140
unusedCfg = & m .cfg .LintersSettings .Unused
141
+ wrapcheckCfg = & m .cfg .LintersSettings .Wrapcheck
140
142
}
141
143
142
144
const megacheckName = "megacheck"
@@ -411,7 +413,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
411
413
WithSince ("v1.30.0" ).
412
414
WithPresets (linter .PresetStyle ).
413
415
WithURL ("https://github.com/ssgreg/nlreturn" ),
414
- linter .NewConfig (golinters .NewWrapcheck ()).
416
+ linter .NewConfig (golinters .NewWrapcheck (wrapcheckCfg )).
415
417
WithSince ("v1.32.0" ).
416
418
WithPresets (linter .PresetStyle , linter .PresetError ).
417
419
WithLoadForGoAnalysis ().
You can’t perform that action at this time.
0 commit comments