-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add configuration to promote/demote severity of messages #2293
Copy link
Copy link
Open
Labels
Enhancement ✨Improvement to a componentImprovement to a componentHigh priorityIssue with more than 10 reactionsIssue with more than 10 reactionsNeeds specification 🔐Accepted as a potential improvement, and needs to specify edge cases, message names, etc.Accepted as a potential improvement, and needs to specify edge cases, message names, etc.
Metadata
Metadata
Assignees
Labels
Enhancement ✨Improvement to a componentImprovement to a componentHigh priorityIssue with more than 10 reactionsIssue with more than 10 reactionsNeeds specification 🔐Accepted as a potential improvement, and needs to specify edge cases, message names, etc.Accepted as a potential improvement, and needs to specify edge cases, message names, etc.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Status Quo
Currently you can disable specific messages or severity classes (error, warning, refactor, convention), so to do pylint runs of various stringency, you could do one of
pylint -E ...pylint --disable=R,C,W ....pylint --disable=R,C ...However, if you have a style guide that might mean one of the "convention" messages is a must-do, then you need to disable all the others, then you can bit-OR the exit code to fail a build on the refactor bit being set. Alternatively, parse the output (ick).
Desired feature
Add a configuration where you can map message codes/names to severity level.
For instance, if I say something like
C0303=Eortrailing-whitespace: error, and run pylint, even if there are no "true" error messages, a C0303 message would cause the exit code to have a 2 in it.Help
I'd be willing to take a stab at a patch, but I'm also not sure if it could be done in a plugin just as well? I'm having some trouble figuring out how. The docs point me towards a learning cliff: "In general, a plugin is a module which should have a function
register, which takes an instance ofpylint.lint.PyLinteras input.", but even looking at the class spec it's not immediately obvious how to hook into it. Are there docs for that I'm not finding or simple (but non-trivial) plugins for example?