From 73b1a493b94d78dec2c0568a399ffcf6b66915cd Mon Sep 17 00:00:00 2001 From: Stefan Hansson Date: Thu, 18 Jan 2024 22:52:17 +0100 Subject: [PATCH] ci: replace Flake8 with Ruff (MR 4741) See similar patch in pmbootstrap for rationale: https://gitlab.com/postmarketOS/pmbootstrap/-/commit/27618d5ffdb0b6cbf9471dc01a2ed14e1655ced0 W504 ignore is removed as the rule does not exist in Ruff. But, since it was ignored anyway, this does not matter. --- .ci/{flake8.sh => ruff.sh} | 4 ++-- .gitlab-ci.yml | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) rename .ci/{flake8.sh => ruff.sh} (71%) diff --git a/.ci/flake8.sh b/.ci/ruff.sh similarity index 71% rename from .ci/flake8.sh rename to .ci/ruff.sh index 0e0cae211..12cbbc1b0 100755 --- a/.ci/flake8.sh +++ b/.ci/ruff.sh @@ -4,11 +4,11 @@ if [ "$(id -u)" = 0 ]; then set -x - apk -q add py3-flake8 + apk -q add ruff exec su "${TESTUSER:-build}" -c "sh -e $0" fi set -x # shellcheck disable=SC2046 -flake8 --ignore E501,F401,E722,W504,W605 $(find .ci -name '*.py') +ruff --ignore E501,F401,E722,W605 $(find .ci -name '*.py') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 807574641..13ecdddb0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,7 +36,7 @@ wiki: - .ci/wiki.sh # testcases linting -flake8: +ruff: stage: lint <<: *only-default only: @@ -46,10 +46,11 @@ flake8: - .ci/* - .ci/*/* before_script: - - apk -q add py-flake8 + - "echo 'https://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories" + - apk -q add ruff script: - .ci/lib/gitlab_prepare_ci.sh - - .ci/flake8.sh + - .ci/ruff.sh # shellcheck and various grep checks shellcheck-grep: