interfacebloat: fix configuration loading (#3194)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
parent
70d595e91d
commit
091d2f4324
pkg
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user