mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-12 11:36:29 +00:00
c28f7cb29f
Initial part of #435
23 lines
657 B
Go
23 lines
657 B
Go
package golinters
|
|
|
|
import (
|
|
"github.com/jingyugao/rowserrcheck/passes/rowserr"
|
|
"golang.org/x/tools/go/analysis"
|
|
|
|
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
|
|
"github.com/golangci/golangci-lint/pkg/lint/linter"
|
|
)
|
|
|
|
func NewRowsErrCheck() *goanalysis.Linter {
|
|
analyzer := rowserr.NewAnalyzer()
|
|
return goanalysis.NewLinter(
|
|
"rowserrcheck",
|
|
"checks whether Err of rows is checked successfully",
|
|
[]*analysis.Analyzer{analyzer},
|
|
nil,
|
|
).WithLoadMode(goanalysis.LoadModeTypesInfo).
|
|
WithContextSetter(func(lintCtx *linter.Context) {
|
|
pkgs := lintCtx.Settings().RowsErrCheck.Packages
|
|
analyzer.Run = rowserr.NewRun(pkgs...)
|
|
})
|
|
}
|