ci(lint): Use pre-commit

This commit is contained in:
Joakim Saario 2022-08-21 22:16:52 +02:00
parent 505eb90479
commit de5538a40f
No known key found for this signature in database
GPG key ID: D8B76D271B7BD453

View file

@ -13,18 +13,16 @@ variables:
LOG_CONFIG: logging.test.conf LOG_CONFIG: logging.test.conf
lint: lint:
variables:
# Space-separated list of directories that should be linted.
REQUIRES_LINT: "aurweb test migrations"
stage: .pre stage: .pre
before_script: before_script:
- pacman -Sy --noconfirm --noprogressbar --cachedir .pkg-cache - pacman -Sy --noconfirm --noprogressbar --cachedir .pkg-cache
archlinux-keyring archlinux-keyring
- pacman -Syu --noconfirm --noprogressbar --cachedir .pkg-cache - pacman -Syu --noconfirm --noprogressbar --cachedir .pkg-cache
python python-isort flake8 git python python-pre-commit
script: script:
- bash -c 'flake8 --count $(echo "$REQUIRES_LINT" | xargs); exit $?' # https://github.com/pre-commit/pre-commit/issues/2178#issuecomment-1002163763
- bash -c 'isort --check-only $(echo "$REQUIRES_LINT" | xargs); exit $?' - export SETUPTOOLS_USE_DISTUTILS=stdlib
- pre-commit run -a
test: test:
stage: test stage: test