Skip to content

init-hook and setup.cfg #2705

@rdehouss

Description

@rdehouss

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)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions