forked from TrueCloudLab/linters
32 lines
674 B
Go
32 lines
674 B
Go
package main
|
|
|
|
import (
|
|
"git.frostfs.info/TrueCloudLab/linters/internal/analyzers/noliteral"
|
|
"golang.org/x/tools/go/analysis"
|
|
)
|
|
|
|
var AnalyzerPlugin analyzerPlugin
|
|
|
|
type analyzerPlugin struct{}
|
|
|
|
// for version ci-lint < '1.5.4'.
|
|
func (*analyzerPlugin) GetAnalyzers() []*analysis.Analyzer {
|
|
analyzer, _ := New(nil)
|
|
return analyzer
|
|
}
|
|
|
|
// 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
|
|
}
|