interfacebloat: fix configuration loading ()

Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
Anton Kachurin 2022-09-05 13:27:46 +03:00 committed by GitHub
parent 70d595e91d
commit 091d2f4324
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

@ -62,6 +62,9 @@ var defaultLintersSettings = LintersSettings{
MaxDeclLines: 1, MaxDeclLines: 1,
MaxDeclChars: 30, MaxDeclChars: 30,
}, },
InterfaceBloat: InterfaceBloatSettings{
Max: 10,
},
Lll: LllSettings{ Lll: LllSettings{
LineLength: 120, LineLength: 120,
TabWidth: 1, TabWidth: 1,

@ -11,10 +11,12 @@ import (
func NewInterfaceBloat(settings *config.InterfaceBloatSettings) *goanalysis.Linter { func NewInterfaceBloat(settings *config.InterfaceBloatSettings) *goanalysis.Linter {
a := analyzer.New() a := analyzer.New()
cfgMap := make(map[string]map[string]interface{}) var cfg map[string]map[string]interface{}
if settings != nil { if settings != nil {
cfgMap[a.Name] = map[string]interface{}{ cfg = map[string]map[string]interface{}{
a.Name: {
analyzer.InterfaceMaxMethodsFlag: settings.Max, analyzer.InterfaceMaxMethodsFlag: settings.Max,
},
} }
} }
@ -22,6 +24,6 @@ func NewInterfaceBloat(settings *config.InterfaceBloatSettings) *goanalysis.Lint
a.Name, a.Name,
a.Doc, a.Doc,
[]*analysis.Analyzer{a}, []*analysis.Analyzer{a},
nil, cfg,
).WithLoadMode(goanalysis.LoadModeSyntax) ).WithLoadMode(goanalysis.LoadModeSyntax)
} }