Upgrade pre-commit hook to use isort 5.12 (#840)

This commit is contained in:
Marko Budiselić 2023-03-26 17:34:51 +02:00 committed by GitHub
parent cb813c3070
commit 8b0dca9eab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 12 deletions

View File

@ -1,16 +1,16 @@
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0 rev: v4.4.0
hooks: hooks:
- id: check-yaml - id: check-yaml
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 22.8.0 rev: 23.1.0
hooks: hooks:
- id: black - id: black
- repo: https://github.com/pycqa/isort - repo: https://github.com/pycqa/isort
rev: 5.10.1 rev: 5.12.0
hooks: hooks:
- id: isort - id: isort
name: isort (python) name: isort (python)

21
init
View File

@ -106,15 +106,18 @@ for hook in $(find $DIR/.githooks -type f -printf "%f\n"); do
echo "Added $hook hook" echo "Added $hook hook"
done; done;
# Install precommit hook # Install precommit hook except on old operating systems because we don't
python3 -m pip install pre-commit # develop on them -> pre-commit hook not required -> we can use latest
python3 -m pre_commit install # packages.
if [ "${DISTRO}" != "centos-7" ] && [ "$DISTRO" != "debian-10" ] && [ "${DISTRO}" != "ubuntu-18.04" ]; then
# Install py format tools python3 -m pip install pre-commit
echo "Install black formatter" python3 -m pre_commit install
python3 -m pip install black==22.8.* # Install py format tools for usage during the development.
echo "Install isort" echo "Install black formatter"
python3 -m pip install isort==5.10.* python3 -m pip install black==23.1.*
echo "Install isort"
python3 -m pip install isort==5.12.*
fi
# Link `include/mgp.py` with `release/mgp/mgp.py` # Link `include/mgp.py` with `release/mgp/mgp.py`
ln -v -f include/mgp.py release/mgp/mgp.py ln -v -f include/mgp.py release/mgp/mgp.py