Skip to content
Snippets Groups Projects
Commit 4e948c6a authored by Luca Weiss's avatar Luca Weiss
Browse files

Use ruff for linting

Use ruff instead of flake8. Aside from being substantially faster, ruff
includes a lot of flake's plug-ins built-in, some of which may be useful
to enable as a follow-up.
parent 6bc53c8c
Branches
Tags
No related merge requests found
#!/bin/sh -e
topdir="$(realpath "$(dirname "$0")/..")"
cd "$topdir"
flake8 $(find -name '*.py')
echo "flake8 check passed"
#!/bin/sh -e
# Description: lint all python scripts
# https://postmarketos.org/pmb-ci
if [ "$(id -u)" = 0 ]; then
set -x
apk -q add ruff
exec su "${TESTUSER:-build}" -c "sh -e $0"
fi
set -x
# __init__.py with additional ignore:
# F401: imported, but not used
# shellcheck disable=SC2046
ruff check --ignore "F401" $(find . -not -path '*/venv/*' -name '__init__.py')
# Check all other files
ruff check --exclude=__init__.py .
# Check formatting
ruff format --diff
......@@ -24,15 +24,11 @@ mr-settings:
- wget -q "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/master/check_mr_settings.py"
- python3 ./check_mr_settings.py
flake8:
ruff:
stage: check
<<: *only-default
image: "alpine:latest"
before_script:
- "apk -q add py3-pip"
- "pip3 -q --disable-pip-version-check install flake8 --break-system-packages"
script:
- ".ci/flake8.sh"
- ".ci/ruff.sh"
upstream-compat-master:
stage: check
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment