github.com/shulhan/golangci-lint@v1.10.1/pkg/lint/linter/config.go (about) 1 package linter 2 3 const ( 4 PresetFormatting = "format" 5 PresetComplexity = "complexity" 6 PresetStyle = "style" 7 PresetBugs = "bugs" 8 PresetUnused = "unused" 9 PresetPerformance = "performance" 10 ) 11 12 type Config struct { 13 Linter Linter 14 EnabledByDefault bool 15 DoesFullImport bool 16 NeedsSSARepr bool 17 InPresets []string 18 Speed int // more value means faster execution of linter 19 20 OriginalURL string // URL of original (not forked) repo, needed for autogenerated README 21 } 22 23 func (lc Config) WithFullImport() Config { 24 lc.DoesFullImport = true 25 return lc 26 } 27 28 func (lc Config) WithSSA() Config { 29 lc.DoesFullImport = true 30 lc.NeedsSSARepr = true 31 return lc 32 } 33 34 func (lc Config) WithPresets(presets ...string) Config { 35 lc.InPresets = presets 36 return lc 37 } 38 39 func (lc Config) WithSpeed(speed int) Config { 40 lc.Speed = speed 41 return lc 42 } 43 44 func (lc Config) WithURL(url string) Config { 45 lc.OriginalURL = url 46 return lc 47 } 48 49 func (lc Config) NeedsProgramLoading() bool { 50 return lc.DoesFullImport 51 } 52 53 func (lc Config) NeedsSSARepresentation() bool { 54 return lc.NeedsSSARepr 55 } 56 57 func (lc Config) GetSpeed() int { 58 return lc.Speed 59 } 60 61 func NewConfig(linter Linter) *Config { 62 return &Config{ 63 Linter: linter, 64 } 65 }