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