I'm setting up a project with Python 3.8.5 (in Visual Studio Code), pre-commit and pylint. In the project pylint is reporting on PyQt5 module imports since they are C based.
To not make Pylint report on this, the .pylintrc
file can be configured with extension-pkg-whitelist=PyQt5
. This works fine in the IDE.
Additionally, I set up pre-commit with pylint like this, but pylint seems to ignore the value PyQt5 since pre-commit still reports on the import errors for pyqt5
- repo: https://github.com/PyCQA/pylint
rev: pylint-2.5.0
hooks:
- id: pylint
args: [--extension-pkg-whitelist=PyQt5]
Main\main.py:1:0: E0401: Unable to import 'PyQt5.QtWidgets' (import-error)
Args reference from offical docs
Pylint does still accept parameters since e.g. passing --errors-only
does work. Invoking pylint with these exact parameters in the cli works as expected: it doesn't report on PyQt5, but invoking through pre-commit doesn't seem to work. I know the argument is noticed since omitting the "PyQt5" as a value result in an error stating that an argument is missing. So somehow the value gets parsed differently than in the cli.
I tried the format given above, this format here, I tried splitting the args like this args: [--extension-pkg-whitelist, PyQt5]
, I tried adding single/double quotes. It doesn't seem to pick it up.
How do you pass args to the hook that require a key and value?
Thanks in advance