-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Allow to disable specific report in a single file using pylint configuration file or command line arguments #2712
Comments
There's currently no way to do that, but sounds like something that might be useful and a bit more convenient for folks that want to disable selectively checks without putting those pragmas in the code. |
Do file-global inline settings like
near the beginning of a file work for you, or would that be too much littering? |
No. I do not want any pylint specific comment in any source code file. I am fine with pylint specific separate file, but I prefer to not use given validator warning at all if it generates any false positive in any of my files. But I would prefer silencing false positive in specific file using pylint configuration file or command line arguments |
This is my first approach on this issue by implementing a plugin: https://gist.github.com/elbakramer/231e565dc65aecca311fba7b3f71479a Acts as if the disable pragma comments were added on every line of matched files. Because that disabling should be done before any other checkers to run, This is a bit off-topic to this issue but I also took liberty of using the glob pattern matching when matching files, This matching behavior can be ambiuous in certain situations but I'm just happy with that so far. |
@matkoniecz would the ignore options work for you ? Standard Checkers |
Is it possible to combine them to disable specific report in a single file? Not all reports in a single file, not to disable rule across all files. |
Right, no. We need per directory configuration, even per file configuration for that. The easy way to do that is to add pragmas at the top of the file but you already know that seeing the stackoverflow answers :) |
Is your feature request related to a problem? Please describe
pylint
has a false positive (unfixable one, in usual situationpylint
would be right).It would be both undesirable to
Describe the solution you'd like
Allow to specify (in config file or command line argument) that given rule should be disabled in a specific file.
Additional context
I have a repository with simple programs, each in multiple stages - from simplest possible to final one with more features. I use it during teaching programming. In this specific case I want to suppress one instance of
W0612: Unused variable 'i' (unused-variable)
as it becomes used one step later and it makes no sense to switch from _ variable name to i variable name just to pacify validator. And adding magic comment is unwanted as confusing beginners by weird comments is undesirable.I made usual searches, I opened SO question but it appears that there is currently now way to do that.
rubocop (ruby linter) has config file that allows to do that - for example:
The text was updated successfully, but these errors were encountered: