Skip to content

Commit 9ff0f31

Browse files
authored
pkg/lint/lintersdb: report all unknown linters at once (golangci#1477)
Otherwise, if one configures multiple invalid linters, or jumps between the versions, it is annoying to get same error with different value N times. Signed-off-by: Mateusz Gozdek <[email protected]>
1 parent 7a1ae96 commit 9ff0f31

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/lint/lintersdb/validator.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,20 @@ func NewValidator(m *Manager) *Validator {
2020
func (v Validator) validateLintersNames(cfg *config.Linters) error {
2121
allNames := append([]string{}, cfg.Enable...)
2222
allNames = append(allNames, cfg.Disable...)
23+
24+
unknownNames := []string{}
25+
2326
for _, name := range allNames {
2427
if v.m.GetLinterConfigs(name) == nil {
25-
return fmt.Errorf("no such linter %v, run 'golangci-lint linters' to see the list of supported linters", name)
28+
unknownNames = append(unknownNames, name)
2629
}
2730
}
2831

32+
if len(unknownNames) > 0 {
33+
return fmt.Errorf("unknown linters: '%v', run 'golangci-lint linters' to see the list of supported linters",
34+
strings.Join(unknownNames, ","))
35+
}
36+
2937
return nil
3038
}
3139

0 commit comments

Comments
 (0)