Skip to content

Commit

Permalink
Replace isort and black with ruff (#17620)
Browse files Browse the repository at this point in the history
Ruff now has decent parity with black and isort, so this is going to just save us a bunch of time
  • Loading branch information
sandhose authored and erikjohnston committed Aug 30, 2024
1 parent 48303fc commit 26c1330
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 440 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/fix_lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,9 @@ jobs:
with:
install-project: "false"

- name: Import order (isort)
- name: Run ruff
continue-on-error: true
run: poetry run isort .

- name: Code style (black)
continue-on-error: true
run: poetry run black .

- name: Semantic checks (ruff)
continue-on-error: true
run: poetry run ruff --fix .
run: poetry run ruff check --fix .

- run: cargo clippy --all-features --fix -- -D warnings
continue-on-error: true
Expand All @@ -49,4 +41,4 @@ jobs:

- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Attempt to fix linting"
commit_message: "Attempt to fix linting"
11 changes: 2 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,8 @@ jobs:
with:
install-project: "false"

- name: Import order (isort)
run: poetry run isort --check --diff .

- name: Code style (black)
run: poetry run black --check --diff .

- name: Semantic checks (ruff)
# --quiet suppresses the update check.
run: poetry run ruff check --quiet .
- name: Check style
run: poetry run ruff check --output-format=github .

lint-mypy:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions changelog.d/17620.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replace `isort` and `black with `ruff`.
4 changes: 1 addition & 3 deletions docs/code_style.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ errors in code.

The necessary tools are:

- [black](https://black.readthedocs.io/en/stable/), a source code formatter;
- [isort](https://pycqa.github.io/isort/), which organises each file's imports;
- [ruff](https://github.com/charliermarsh/ruff), which can spot common errors; and
- [ruff](https://github.com/charliermarsh/ruff), which can spot common errors and enforce a consistent style; and
- [mypy](https://mypy.readthedocs.io/en/stable/), a type checker.

See [the contributing guide](development/contributing_guide.md#run-the-linters) for instructions
Expand Down
126 changes: 20 additions & 106 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 26c1330

Please sign in to comment.