-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
dev: rewrite linters Manager #4419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
925b221
to
5737c95
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff, thanks for all this @ldez ⭐
9ddce62
to
4daab12
Compare
Even if I'm impatient to merge this PR, we will wait a bit for feedback from @Antonboom |
Co-authored-by: Simon Sawert <[email protected]>
4daab12
to
9d196f4
Compare
d2a825e
to
83c68d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No principal comments.
Thanks 🎉
} | ||
|
||
if l.DisableAll { | ||
if len(l.Enable) == 0 && len(l.Presets) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cosmetic: gocritic also highlights that linters were already enabled or disabled via presets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gocritic handles its own rules, not our linters or presets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of course, I meant checkers
just to do it for linters too, for analogy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I don't understand what is your suggestion here.
0a3a59f
to
ad6b6e3
Compare
@bombsimon @Antonboom Be prepared because after this merge I will open 6 PRs (5 today and 1 later) 😸 Note: every time I want to add you both as reviewers I laugh because of your login: I put a |
I just put a log inside the methods used to build/load linters/plugins, and validate linters in the configuration.
You can see the problem easily.
Before the PR #4404:
After the PR #4404:
With this PR:
This behavior has been here since nearly the beginning of golangci-lint but the problem has increased with time.
Summary of the execution after #4404, #4412, and this PR:
config.Loader.Load
).linterdb.NewManager
).linterdb.LinterBuilder.Build
,linterdb.PluginBuilder.Build
)linterdb.Validator.Validate
)Everything is done once and only once.
The improvement of the performance is not high, but the impact on debugging and maintainability is huge!
Next Step
A proposal for a new flag option and a bit of cleaning.