enhancement: introduce Ruff for Python linter for reordering and removing unused imports with automated pre-commit and sytle check (#2366)

This commit is contained in:
Bowen Liang
2024-02-06 13:21:13 +08:00
committed by GitHub
parent 42344795cd
commit 843280f82b
333 changed files with 2109 additions and 1050 deletions

View File

@@ -2,10 +2,11 @@
set -x
# python style checks rely on `isort` in path
if ! command -v isort &> /dev/null
then
echo "Skip Python imports linting, since 'isort' is not available. Please install it with 'pip install isort'."
else
isort --settings ./.github/linters/.isort.cfg ./
# python style checks rely on `ruff` in path
if ! command -v ruff &> /dev/null; then
echo "Installing Ruff ..."
pip install ruff
fi
# run ruff linter
ruff check --fix ./api