mirror of
https://github.com/scratchfoundation/golangci-lint.git
synced 2025-08-28 22:28:43 -04:00
dev: rewrite linters Manager (#4419)
This commit is contained in:
parent
26f8088b38
commit
b14d05cdb4
27 changed files with 1749 additions and 1825 deletions
|
@ -1,5 +1,10 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const severityRuleMinConditionsCount = 1
|
||||
|
||||
type Severity struct {
|
||||
|
@ -8,6 +13,20 @@ type Severity struct {
|
|||
Rules []SeverityRule `mapstructure:"rules"`
|
||||
}
|
||||
|
||||
func (s *Severity) Validate() error {
|
||||
if len(s.Rules) > 0 && s.Default == "" {
|
||||
return errors.New("can't set severity rule option: no default severity defined")
|
||||
}
|
||||
|
||||
for i, rule := range s.Rules {
|
||||
if err := rule.Validate(); err != nil {
|
||||
return fmt.Errorf("error in severity rule #%d: %w", i, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type SeverityRule struct {
|
||||
BaseRule `mapstructure:",squash"`
|
||||
Severity string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue