make: replace flake8 with ruff

Ruff (https://github.com/astral-sh/ruff) is a Python linter
written in Rust, designed to replace Flake8. It is significantly
faster and actively maintained.

In addition to replacing flake8 with ruff, this patch also
creates separate makefile targets for ruff, shellcheck and
codespell, so that they can be tested independently.

RUFF_FLAGS can be used to specify options such as '--fix'.
Example:
	make lint
	make ruff RUFF_FLAGS=--fix

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
Radostin Stoyanov 2024-02-09 13:04:58 +00:00 committed by Andrei Vagin
parent 7fd4a15e68
commit e0b74f558b
11 changed files with 33 additions and 26 deletions

View file

@ -41,7 +41,6 @@ RUN apk add \
go \
e2fsprogs \
py-yaml \
py3-flake8 \
py3-importlib-metadata \
asciidoctor

View file

@ -31,7 +31,6 @@ RUN pacman -Syu --noconfirm \
bash \
go \
python-yaml \
flake8 \
asciidoctor \
python-junit-xml \
python-importlib-metadata \

View file

@ -26,7 +26,6 @@ RUN yum install -y --allowerasing \
protobuf-c-devel \
protobuf-devel \
python3-devel \
python3-flake8 \
python3-PyYAML \
python3-protobuf \
python3-pip \

View file

@ -23,7 +23,6 @@ dnf install -y \
procps-ng \
protobuf-c-devel \
protobuf-devel \
python3-flake8 \
python3-PyYAML \
python3-protobuf \
python3-junit_xml \

View file

@ -4,7 +4,7 @@ set -x -e
CI_PKGS=(protobuf-c-compiler libprotobuf-c-dev libaio-dev libgnutls28-dev
libgnutls30 libprotobuf-dev protobuf-compiler libcap-dev
libnl-3-dev gdb bash libnet-dev util-linux asciidoctor
libnl-route-3-dev time flake8 libbsd-dev python3-yaml
libnl-route-3-dev time libbsd-dev python3-yaml
libperl-dev pkg-config python3-protobuf python3-pip
python3-importlib-metadata python3-junit.xml libdrm-dev)

View file

@ -38,8 +38,8 @@ setup() {
ssh default sudo dnf upgrade -y
ssh default sudo dnf install -y gcc git gnutls-devel nftables-devel libaio-devel \
libasan libcap-devel libnet-devel libnl3-devel libbsd-devel make protobuf-c-devel \
protobuf-devel python3-flake8 python3-protobuf python3-importlib-metadata \
python3-junit_xml rubygem-asciidoctor iptables libselinux-devel libbpf-devel
protobuf-devel python3-protobuf python3-importlib-metadata python3-junit_xml \
rubygem-asciidoctor iptables libselinux-devel libbpf-devel
# Disable sssd to avoid zdtm test failures in pty04 due to sssd socket
ssh default sudo systemctl mask sssd
ssh default cat /proc/cmdline

4
scripts/ruff.toml Normal file
View file

@ -0,0 +1,4 @@
# Ignore `E401` (import violations) in all `__init__.py` files
[lint.per-file-ignores]
"__init__.py" = ["F401"]