mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-13 12:06:29 +00:00
c28f7cb29f
Initial part of #435
27 lines
601 B
Go
27 lines
601 B
Go
package golinters
|
|
|
|
import (
|
|
mnd "github.com/tommy-muehle/go-mnd/v2"
|
|
"golang.org/x/tools/go/analysis"
|
|
|
|
"github.com/golangci/golangci-lint/pkg/config"
|
|
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
|
|
)
|
|
|
|
func NewGoMND(cfg *config.Config) *goanalysis.Linter {
|
|
analyzers := []*analysis.Analyzer{
|
|
mnd.Analyzer,
|
|
}
|
|
|
|
var linterCfg map[string]map[string]interface{}
|
|
if cfg != nil {
|
|
linterCfg = cfg.LintersSettings.Gomnd.Settings
|
|
}
|
|
|
|
return goanalysis.NewLinter(
|
|
"gomnd",
|
|
"An analyzer to detect magic numbers.",
|
|
analyzers,
|
|
linterCfg,
|
|
).WithLoadMode(goanalysis.LoadModeSyntax)
|
|
}
|