mirror of
https://github.com/mgechev/revive.git
synced 2025-11-23 22:04:49 +02:00
Allow revive to be called with extra linters (#650)
This change allows revive to be called from main.go in other libraries and pass in a list of custom linters to be added to the built-in linters found in config Co-authored-by: Bernardo Heynemann <bernardo.heynemann@coinbase.com> Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
This commit is contained in:
committed by
GitHub
parent
5ce2ff53c0
commit
1c283837a9
@@ -107,11 +107,17 @@ func getFormatters() map[string]lint.Formatter {
|
||||
}
|
||||
|
||||
// GetLintingRules yields the linting rules that must be applied by the linter
|
||||
func GetLintingRules(config *lint.Config) ([]lint.Rule, error) {
|
||||
func GetLintingRules(config *lint.Config, extraRules []lint.Rule) ([]lint.Rule, error) {
|
||||
rulesMap := map[string]lint.Rule{}
|
||||
for _, r := range allRules {
|
||||
rulesMap[r.Name()] = r
|
||||
}
|
||||
for _, r := range extraRules {
|
||||
if _, ok := rulesMap[r.Name()]; ok {
|
||||
continue
|
||||
}
|
||||
rulesMap[r.Name()] = r
|
||||
}
|
||||
|
||||
var lintingRules []lint.Rule
|
||||
for name, ruleConfig := range config.Rules {
|
||||
|
||||
Reference in New Issue
Block a user