.pre-commit-pylint: auto install pylint in venv and poetry env if missing

This commit is contained in:
Benjamin Renard 2024-02-13 13:41:35 +01:00
parent bdbe82c3ea
commit 67125661fd
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -5,11 +5,13 @@ PWD=`pwd`
if [ -d "$PWD/venv" ]
then
echo "Run pylint inside venv ($PWD/venv)..."
[ ! -e "$PWD/venv/bin/pylint" ] && $PWD/venv/bin/python -m pip install pylint
$PWD/venv/bin/pylint "$@"
exit $?
elif [ -e "$PWD/pyproject.toml" ]
then
echo "Run pylint using poetry..."
poetry run pylint --version > /dev/null 2>&1 || poetry run python -m pip install pylint
poetry run pylint "$@"
exit $?
else