Skip to content

Commit

Permalink
Introduce ruff as a Python linter (#82)
Browse files Browse the repository at this point in the history
The `ruff` linter has support for checks that some of our existing
linters don't, most notably the ability to detect (and fix, if
requested) unused imports. Unused imports are a cause of [many PR
comments](reboot-dev/mono#2159) and wasted
time.

`ruff` is also a code formatter, but there's currently no strong reason
to switch from `yapf` to `ruff` for that in our codebase.
  • Loading branch information
rjhuijsman authored Jan 30, 2024
1 parent b95557b commit 276c313
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion check-code-style/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ runs:
pip install \
yapf==0.33.0 \
mypy==1.2.0 \
isort==5.12.0
isort==5.12.0 \
ruff==0.1.14
shell: bash

- name: Run code style checks on all code.
Expand Down
3 changes: 3 additions & 0 deletions check-style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ if [ ! -z "${python_files}" ]; then
# Run yapf.
run_check yapf -d -p ${python_files}

# Run ruff.
run_check ruff check ${python_files}

# Run isort
run_check isort --check --diff ${python_files}
fi
Expand Down

0 comments on commit 276c313

Please sign in to comment.