Allow to enable/disable plugin error codes #13419
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #12987
(I copied this from the way
warn_unused_configsis handled, and I don't think parser errors can be triggered after plugins were loaded?)Duplicating the code seems a bit ugly, but the way the
Errorsinstance is created before loading the plugins I'm not quite sure what the implications would be if the error code loading is delayed completely.(Another thing I noticed: the
Errorsconstructor creates new sets when passed empty sets, but shares non-empty sets otherwise. That seems bad - probably should either share always or clone always.)Test Plan
No idea how to test plugins.
I used this manually (and successfully) by having something like this in
pyproject.tomlin a project using django: