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

init-hook and setup.cfg #2705

Closed
rdehouss opened this issue Jan 24, 2019 · 3 comments
Closed

init-hook and setup.cfg #2705

rdehouss opened this issue Jan 24, 2019 · 3 comments

Comments

@rdehouss
Copy link

Hello,

I'm using the init-hook to tell pylint where to find my librairies and it works fine in .pylintrc but it's not working when I move the content of .pylintrc in the setup.cfg file

Steps to reproduce

  1. Checkout https://github.com/rdehouss/pylint-issue-init-hook-setup-cfg
  2. Install pylint with pipenv (pipenv install --dev)
  3. Execute find . -name "*.py" -not -path '*/\.*' -exec pipenv run pylint --rcfile=.pylintrc '{}' + => OK
  4. Execute find . -name "*.py" -not -path '*/\.*' -exec pipenv run pylint --rcfile=setup.cfg '{}' + => NOK

Please note that the disable=missing-docstring works well since when I remove it, I get

find . -name "*.py" -not -path '*/\.*' -exec pipenv run pylint --rcfile=setup.cfg '{}' +
************* Module src.hello_world
src/hello_world.py:1:0: C0111: Missing module docstring (missing-docstring)
src/hello_world.py:1:0: E0401: Unable to import 'libs.hello_world' (import-error)
************* Module src.libs.hello_world
src/libs/hello_world.py:1:0: C0111: Missing module docstring (missing-docstring)
src/libs/hello_world.py:1:0: C0111: Missing function docstring (missing-docstring)

-------------------------------------------------------------------
Your code has been rated at -6.00/10 (previous run: 0.00/10, -6.00)

Current behavior

init-hook seems to have no effect

$ find . -name "*.py" -not -path '*/\.*' -exec pipenv run pylint --rcfile=.pylintrc '{}' +

------------------------------------
Your code has been rated at 10.00/10

$ find . -name "*.py" -not -path '*/\.*' -exec pipenv run pylint --rcfile=setup.cfg '{}' +
************* Module src.hello_world
src/hello_world.py:1:0: E0401: Unable to import 'libs.hello_world' (import-error)

--------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 10.00/10, -10.00)

Expected behavior

init-hook works like when it is in .pylintrc

pylint --version output

pylint 2.2.2
astroid 2.1.0
Python 3.7.0 (default, Sep 18 2018, 18:47:22)
[Clang 9.1.0 (clang-902.0.39.2)]
@PCManticore
Copy link
Contributor

Hi, thanks for the report. Currently pylint does not support setup.cfg, anything else other than the sanctioned format in pylintrc is not going to be supported due to various assumptions of the config parser we use. This might change in the future with #617 but can't promise an exact date when that is going to be supported.

@Ran-n
Copy link

Ran-n commented Feb 16, 2023

This is still not going to be changed?

@Pierre-Sassoulas
Copy link
Member

We support pylintrc, pyproject.toml, and setup.cfg check the doc here: https://pylint.readthedocs.io/en/latest/user_guide/configuration/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants