Skip to content

Commit

Permalink
Restore fast linters meaning (#1844)
Browse files Browse the repository at this point in the history
* fix: remove useless conditions.

* feat: considere revive as slow.

* feat: considere linters with go analysis as slow.
  • Loading branch information
ldez committed Mar 15, 2021
1 parent cd2025d commit 87d37c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/lint/linter/config.go
Expand Up @@ -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 {
Expand All @@ -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
}

Expand Down
1 change: 1 addition & 0 deletions pkg/lint/lintersdb/manager.go
Expand Up @@ -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).
Expand Down

0 comments on commit 87d37c6

Please sign in to comment.