Denis Isaev a6b91ccc77 Fix #124: support unparam linter
1. Support unparam linter and fix found issues
2. Replace forked mvdan.cc/lint and mvdan.cc/interfacer with the
upstream ones
3. Minimize forked megacheck: move the most of it's code to this repo
4. Use golang.org/x/tools/go/ssa import path instead of custom fork
paths
5. In golang.org/x/tools/go/{ssa,callgraph} use changed code from
honnef.co/go/tools
6. Add megacheck.check-unexported option: it found some issues in
the repo, fixed them all
2018-06-30 12:24:07 +03:00

66 lines
1.2 KiB
Go

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 NewConfig(linter Linter) *Config {
return &Config{
Linter: linter,
}
}