Files
piper/tools/python-ruff.sh
Yaroslav Chvanov a1e81e41d2 build: add ruff for Python linting
The tests are failing, they will be fixed in subsequent commits.
2023-03-04 17:13:05 +03:00

22 lines
422 B
Bash
Executable File

#!/bin/sh
if [ -z "$MESON_SOURCE_ROOT" ]; then
echo >&2 "Expected \$MESON_SOURCE_ROOT to be set. Are you sure you are running this through ninja?"
exit 100
fi
cd "$MESON_SOURCE_ROOT" || exit 101
files=$(git ls-files "*.py" "*.py.in")
if [ -z "$files" ]; then
echo >&2 "Git didn't find any files"
exit 77
fi
command -v ruff >/dev/null 2>&1 || {
echo >&2 "ruff is not installed"
exit 77
}
ruff check --fix $files