Restore fast linters meaning (#1844)

* fix: remove useless conditions.

* feat: considere revive as slow.

* feat: considere linters with go analysis as slow.
This commit is contained in:
Ludovic Fernandez 2021-03-15 08:13:54 +01:00 committed by GitHub
parent cd2025d1be
commit 87d37c6cf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -35,7 +35,7 @@ func (lc *Config) ConsiderSlow() *Config {
}
func (lc *Config) IsSlowLinter() bool {
return lc.IsSlow || (lc.LoadMode&packages.NeedTypesInfo != 0 && lc.LoadMode&packages.NeedDeps != 0)
return lc.IsSlow
}
func (lc *Config) WithLoadFiles() *Config {
@ -46,6 +46,7 @@ func (lc *Config) WithLoadFiles() *Config {
func (lc *Config) WithLoadForGoAnalysis() *Config {
lc = lc.WithLoadFiles()
lc.LoadMode |= packages.NeedImports | packages.NeedDeps | packages.NeedExportsFile | packages.NeedTypesSizes
lc.IsSlow = true
return lc
}

View File

@ -376,6 +376,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
WithURL("https://github.com/nishanths/predeclared"),
linter.NewConfig(golinters.NewRevive(reviveCfg)).
WithPresets(linter.PresetStyle).
ConsiderSlow().
WithURL("https://github.com/mgechev/revive"),
linter.NewConfig(golinters.NewDurationCheck()).
WithPresets(linter.PresetBugs).