-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Every option in setup.cfg is loaded, even when the section is unknown to pylint #4371
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
Comments
Thank you for opening the issue. Do you want to open a merge request with the proposed changes ? :) |
I wanted to get some insights / feedback first before jumping with the fix. I'm mostly concern on who's filling |
I can confirm that this is indeed an issue. I have a single setup.cfg file with both pylint and flake8 configuration options. I want to ignore a specific subdirectory with the Elsewhere in my configuration file I have a It seems that pylint is not properly scanning only its own sections in the config file. Interestingly enough, re-ordering the sections makes no difference. if the |
Good point, yes, I think so. The way it's done right now each plugin has his own section in the configuration so it can have arbitrary name added by external code. Theorically a Thinking about two solutions on the top of my head:
|
This is a slightly different issue from what @mteiste has seen with #4272 . My issue is with all sections and options defined in
setup.cfg
are processed/loaded, even if those sections are for other tools and unknown topylint
.This has the effect of setting pylint's ignore to
D107,D400,D401
.Going through the code, it feels like the problem is somewhere in option_manager_mixin.py, either at
read_config_line
line 298:299 or atload_config_file
line 312.Apparently, Toml files are not affected because the logic is set to read from
content["tool"]["pylint"]
. But forsetup.cfg
there's notry / except
block, iterating through every section:I think
pylint
should filtered / excluded any section that's not part of any pylint group ->self._mygroups
.Steps to reproduce
Given a config file
setup.cfg
Current behavior
Result of
pylint --generate-rcfile | grep -A2 'ignore='
:-->
Expected behavior
Result of
pylint --generate-rcfile | grep -A2 'ignore='
:pylint --version output
Result of
pylint --version
output:Workaround
I had to monkey patch https://github.com/PyCQA/pylint/blob/master/pylint/config/option_manager_mixin.py#L308 with
Resulting in:
The text was updated successfully, but these errors were encountered: