|
8 | 8 | "strings" |
9 | 9 |
|
10 | 10 | "github.com/golangci/golangci-lint/pkg/config" |
| 11 | + "github.com/golangci/golangci-lint/pkg/lint/linter" |
11 | 12 | "github.com/golangci/golangci-lint/pkg/logutils" |
12 | 13 | ) |
13 | 14 |
|
@@ -38,17 +39,30 @@ func (v Validator) Validate(cfg *config.Config) error { |
38 | 39 | } |
39 | 40 |
|
40 | 41 | func (v Validator) validateLintersNames(cfg *config.Linters) error { |
41 | | - allNames := cfg.Enable |
42 | | - allNames = append(allNames, cfg.Disable...) |
43 | | - |
44 | 42 | var unknownNames []string |
45 | 43 |
|
46 | | - for _, name := range allNames { |
| 44 | + for _, name := range cfg.Enable { |
47 | 45 | if v.m.GetLinterConfigs(name) == nil { |
48 | 46 | unknownNames = append(unknownNames, name) |
49 | 47 | } |
50 | 48 | } |
51 | 49 |
|
| 50 | + for _, name := range cfg.Disable { |
| 51 | + lcs := v.m.GetLinterConfigs(name) |
| 52 | + if len(lcs) == 0 { |
| 53 | + unknownNames = append(unknownNames, name) |
| 54 | + continue |
| 55 | + } |
| 56 | + |
| 57 | + for _, lc := range lcs { |
| 58 | + if lc.IsDeprecated() && lc.Deprecation.Level > linter.DeprecationWarning { |
| 59 | + v.m.log.Warnf("The linter %q is deprecated (step 2) and deactivated. "+ |
| 60 | + "It should be removed from the list of disabled linters. "+ |
| 61 | + "https://golangci-lint.run/product/roadmap/#linter-deprecation-cycle", lc.Name()) |
| 62 | + } |
| 63 | + } |
| 64 | + } |
| 65 | + |
52 | 66 | if len(unknownNames) > 0 { |
53 | 67 | return fmt.Errorf("unknown linters: '%v', run 'golangci-lint help linters' to see the list of supported linters", |
54 | 68 | strings.Join(unknownNames, ",")) |
|
0 commit comments