lint: don't run analyzers that are completely disabled
@@ -107,11 +107,24 @@ type CumulativeChecker interface {
}
func (l *Linter) Lint(cfg *packages.Config, patterns []string) ([]Problem, error) {
+ var allAnalyzers []*analysis.Analyzer
+ allAnalyzers = append(allAnalyzers, l.Checkers...)
+ for _, cum := range l.CumulativeCheckers {
+ allAnalyzers = append(allAnalyzers, cum.Analyzer())
+ }
+
+ allowed := FilterChecks(allAnalyzers, config.DefaultConfig.Merge(l.Config).Checks)
var analyzers []*analysis.Analyzer
- analyzers = append(analyzers, l.Checkers...)
+ for _, c := range l.Checkers {
+ if allowed[c.Name] {
+ analyzers = append(analyzers, c)
+ }
+ }
for _, cum := range l.CumulativeCheckers {
+ if allowed[cum.Analyzer().Name] {
analyzers = append(analyzers, cum.Analyzer())
}
+ }
r, err := NewRunner(&l.Stats)
if err != nil {
