File tree Expand file tree Collapse file tree 6 files changed +37
-8
lines changed Expand file tree Collapse file tree 6 files changed +37
-8
lines changed Original file line number Diff line number Diff line change @@ -550,6 +550,18 @@ linters-settings:
550550 multi-if : false # Enforces newlines (or comments) after every multi-line if statement
551551 multi-func : false # Enforces newlines (or comments) after every multi-line function signature
552552
553+ wrapcheck :
554+ # An array of strings that specify substrings of signatures to ignore.
555+ # If this set, it will override the default set of ignored signatures.
556+ # See https://github.com/tomarrell/wrapcheck#configuration for more information.
557+ ignoreSigs :
558+ - .Errorf(
559+ - errors.New(
560+ - errors.Unwrap(
561+ - .Wrap(
562+ - .Wrapf(
563+ - .WithMessage(
564+
553565 wsl :
554566 # See https://github.com/bombsimon/wsl/blob/master/doc/configuration.md for
555567 # documentation of available settings. These are the defaults for
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ require (
7575 github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b
7676 github.com/tetafro/godot v1.4.6
7777 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
7979 github.com/tommy-muehle/go-mnd/v2 v2.3.2
8080 github.com/ultraware/funlen v0.0.3
8181 github.com/ultraware/whitespace v0.0.4
Original file line number Diff line number Diff line change @@ -130,6 +130,7 @@ type LintersSettings struct {
130130 Unused StaticCheckSettings
131131 Varcheck VarCheckSettings
132132 Whitespace WhitespaceSettings
133+ Wrapcheck WrapcheckSettings
133134 WSL WSLSettings
134135
135136 Custom map [string ]CustomLinterSettings
@@ -430,6 +431,10 @@ type WhitespaceSettings struct {
430431 MultiFunc bool `mapstructure:"multi-func"`
431432}
432433
434+ type WrapcheckSettings struct {
435+ IgnoreSigs []string `mapstructure:"ignoreSigs"`
436+ }
437+
433438type WSLSettings struct {
434439 StrictAppend bool `mapstructure:"strict-append"`
435440 AllowAssignAndCallCuddle bool `mapstructure:"allow-assign-and-call"`
Original file line number Diff line number Diff line change 11package golinters
22
33import (
4- "github.com/tomarrell/wrapcheck/wrapcheck"
4+ "github.com/tomarrell/wrapcheck/v2/ wrapcheck"
55 "golang.org/x/tools/go/analysis"
66
7+ "github.com/golangci/golangci-lint/pkg/config"
78 "github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
89)
910
1011const wrapcheckName = "wrapcheck"
1112
12- func NewWrapcheck () * goanalysis.Linter {
13+ func NewWrapcheck (settings * config.WrapcheckSettings ) * goanalysis.Linter {
14+ cfg := wrapcheck .NewDefaultConfig ()
15+ if settings != nil {
16+ if len (settings .IgnoreSigs ) != 0 {
17+ cfg .IgnoreSigs = settings .IgnoreSigs
18+ }
19+ }
20+
21+ a := wrapcheck .NewAnalyzer (cfg )
22+
1323 return goanalysis .NewLinter (
1424 wrapcheckName ,
15- wrapcheck . Analyzer .Doc ,
16- []* analysis.Analyzer {wrapcheck . Analyzer },
25+ a .Doc ,
26+ []* analysis.Analyzer {a },
1727 nil ,
1828 ).WithLoadMode (goanalysis .LoadModeTypesInfo )
1929}
Original file line number Diff line number Diff line change @@ -117,6 +117,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
117117 var staticcheckCfg * config.StaticCheckSettings
118118 var stylecheckCfg * config.StaticCheckSettings
119119 var unusedCfg * config.StaticCheckSettings
120+ var wrapcheckCfg * config.WrapcheckSettings
120121
121122 if m .cfg != nil {
122123 govetCfg = & m .cfg .LintersSettings .Govet
@@ -137,6 +138,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
137138 staticcheckCfg = & m .cfg .LintersSettings .Staticcheck
138139 stylecheckCfg = & m .cfg .LintersSettings .Stylecheck
139140 unusedCfg = & m .cfg .LintersSettings .Unused
141+ wrapcheckCfg = & m .cfg .LintersSettings .Wrapcheck
140142 }
141143
142144 const megacheckName = "megacheck"
@@ -411,7 +413,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
411413 WithSince ("v1.30.0" ).
412414 WithPresets (linter .PresetStyle ).
413415 WithURL ("https://github.com/ssgreg/nlreturn" ),
414- linter .NewConfig (golinters .NewWrapcheck ()).
416+ linter .NewConfig (golinters .NewWrapcheck (wrapcheckCfg )).
415417 WithSince ("v1.32.0" ).
416418 WithPresets (linter .PresetStyle , linter .PresetError ).
417419 WithLoadForGoAnalysis ().
You can’t perform that action at this time.
0 commit comments