generated from TrueCloudLab/basic
33 lines
877 B
Go
33 lines
877 B
Go
package main
|
|
|
|
import (
|
|
noliteral "git.frostfs.info/TrueCloudLab/linters/internal/analyzers/noliteral"
|
|
"github.com/mitchellh/mapstructure"
|
|
"golang.org/x/tools/go/analysis"
|
|
)
|
|
|
|
var AnalyzerPlugin analyzerPlugin
|
|
|
|
type analyzerPlugin struct{}
|
|
|
|
// for version ci-lint < '1.5.4'.
|
|
func (*analyzerPlugin) GetAnalyzers() []*analysis.Analyzer {
|
|
return []*analysis.Analyzer{noliteral.LogsAnalyzer}
|
|
}
|
|
|
|
// for version ci-lint >= '1.5.4'.
|
|
func New(conf any) ([]*analysis.Analyzer, error) {
|
|
var config noliteral.Configuration
|
|
|
|
if confMap, ok := conf.(map[string]any); ok {
|
|
err := mapstructure.Decode(confMap, &config)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
noliteral.Config.TargetMethods = append(noliteral.Config.TargetMethods, config.TargetMethods...)
|
|
noliteral.Config.ConstantsPackage = config.ConstantsPackage
|
|
}
|
|
|
|
return []*analysis.Analyzer{noliteral.LogsAnalyzer}, nil
|
|
}
|