Skip to content
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

Some options are not parsed correctly from setup.cfg #3630

Closed
zedrdave opened this issue May 16, 2020 · 3 comments · Fixed by #6577
Closed

Some options are not parsed correctly from setup.cfg #3630

zedrdave opened this issue May 16, 2020 · 3 comments · Fixed by #6577

Comments

@zedrdave
Copy link

zedrdave commented May 16, 2020

With this recent PR, pylint is supposed to support loading options through setup.cfg.

I am finding that while it loads some options fine, it fails to load many options (a little unclear on why, but it seems to come down to the section where they are defined). E.g, this works:

[tool.pylint.MASTER]
init-hook="from pylint.config import find_pylintrc; import os, sys; sys.path.append(os.path.dirname(find_pylintrc())); "

This does not:

[tool.pylint.MASTER]
load-plugins=pylint_flask,pylint_flask_sqlalchemy

Oddly, this does:

[MASTER]
load-plugins=pylint_flask,pylint_flask_sqlalchemy

But neither of these two works:

[tool.pylint.FORMAT]
max-line-length=220
ignore-long-lines=[a-z]*

[FORMAT]
max-line-length=220
ignore-long-lines=[a-z]*

and yet, this works:

[tool.pylint.FORMAT]
good-names-rgxs=[a-z]

All these options work fine if I add them to a pylintrc file, so it does not seem to be an issue of format.

I have looked through the code a bit (which is how I was able to figure out that load-plugins worked with the short section name), but I cannot figure out what it is doing with these missing FORMAT options…

@AWhetter
Copy link
Contributor

Are you sure tool.pylint.FORMAT works? Sections need to to start with "pylint." rather than "tool.pylint".

@zedrdave
Copy link
Author

@AWhetter thanks for the pointer: I indeed tried removing the tool. part everywhere and it seems to work.

As for tool.pylint.FORMAT: surprisingly, yes, it does work too (but not the others). It's also the version that is recommended in the doc.

Maybe someone should update the doc (or the code) to make this clear?

@AWhetter
Copy link
Contributor

Where is the documentation recommending tool.pylint.FORMAT? I can't find it. There's this page but it says to use pylint. for setup.cfg and tool.pylint. for pyproject.toml: https://github.com/PyCQA/pylint/blob/master/doc/user_guide/run.rst

@Pierre-Sassoulas Pierre-Sassoulas self-assigned this May 11, 2022
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.14.0 milestone May 11, 2022
@DanielNoord DanielNoord added this to To do: in Migration to argparse via automation May 11, 2022
@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 2.14.0, 2.15.0 May 16, 2022
@DanielNoord DanielNoord modified the milestones: 2.15.0, 2.14.4 Jun 29, 2022
Migration to argparse automation moved this from To do: to Done Jun 29, 2022
DanielNoord added a commit that referenced this issue Jun 29, 2022
Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this issue Jun 29, 2022
…pylint-dev#6577)

Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
Pierre-Sassoulas added a commit that referenced this issue Jun 29, 2022
Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

5 participants