linters/main.go

33 lines
674 B
Go
Raw Normal View History

2023-07-18 08:16:27 +00:00
package main
import (
"git.frostfs.info/TrueCloudLab/linters/internal/analyzers/noliteral"
2023-07-18 08:16:27 +00:00
"golang.org/x/tools/go/analysis"
)
var AnalyzerPlugin analyzerPlugin
type analyzerPlugin struct{}
// for version ci-lint < '1.5.4'.
2023-07-18 08:16:27 +00:00
func (*analyzerPlugin) GetAnalyzers() []*analysis.Analyzer {
analyzer, _ := New(nil)
return analyzer
2023-07-18 08:16:27 +00:00
}
// for version ci-lint >= '1.5.4'.
func New(conf any) ([]*analysis.Analyzer, error) {
confMap, ok := conf.(map[string]any)
var noliteralConfig any
if ok {
noliteralConfig = confMap["noliteral"]
}
noliteral, err := noliteral.New(noliteralConfig)
if err != nil {
return nil, err
}
return []*analysis.Analyzer{noliteral}, nil
}