golangci-lint/pkg/golinters/wrapcheck.go
dependabot[bot] b0ff233b2c
build(deps): bump github.com/tomarrell/wrapcheck/v2 from 2.5.0 to 2.6.0 (#2696)
* build(deps): bump github.com/tomarrell/wrapcheck/v2 from 2.5.0 to 2.6.0

Bumps [github.com/tomarrell/wrapcheck/v2](https://github.com/tomarrell/wrapcheck) from 2.5.0 to 2.6.0.
- [Release notes](https://github.com/tomarrell/wrapcheck/releases)
- [Commits](https://github.com/tomarrell/wrapcheck/compare/v2.5.0...v2.6.0)

---
updated-dependencies:
- dependency-name: github.com/tomarrell/wrapcheck/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* add new option

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2022-03-27 15:33:36 +03:00

39 lines
970 B
Go

package golinters
import (
"github.com/tomarrell/wrapcheck/v2/wrapcheck"
"golang.org/x/tools/go/analysis"
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)
const wrapcheckName = "wrapcheck"
func NewWrapcheck(settings *config.WrapcheckSettings) *goanalysis.Linter {
cfg := wrapcheck.NewDefaultConfig()
if settings != nil {
if len(settings.IgnoreSigs) != 0 {
cfg.IgnoreSigs = settings.IgnoreSigs
}
if len(settings.IgnoreSigRegexps) != 0 {
cfg.IgnoreSigRegexps = settings.IgnoreSigRegexps
}
if len(settings.IgnorePackageGlobs) != 0 {
cfg.IgnorePackageGlobs = settings.IgnorePackageGlobs
}
if len(settings.IgnoreInterfaceRegexps) != 0 {
cfg.IgnoreInterfaceRegexps = settings.IgnoreInterfaceRegexps
}
}
a := wrapcheck.NewAnalyzer(cfg)
return goanalysis.NewLinter(
wrapcheckName,
a.Doc,
[]*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
}