Skip to content

Commit cdd5979

Browse files
authored
Replace isort and black with ruff (#17620)
Ruff now has decent parity with black and isort, so this is going to just save us a bunch of time
1 parent 89801e0 commit cdd5979

File tree

11 files changed

+56
-440
lines changed

11 files changed

+56
-440
lines changed

.github/workflows/fix_lint.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,9 @@ jobs:
2929
with:
3030
install-project: "false"
3131

32-
- name: Import order (isort)
32+
- name: Run ruff
3333
continue-on-error: true
34-
run: poetry run isort .
35-
36-
- name: Code style (black)
37-
continue-on-error: true
38-
run: poetry run black .
39-
40-
- name: Semantic checks (ruff)
41-
continue-on-error: true
42-
run: poetry run ruff --fix .
34+
run: poetry run ruff check --fix .
4335

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

5042
- uses: stefanzweifel/git-auto-commit-action@v5
5143
with:
52-
commit_message: "Attempt to fix linting"
44+
commit_message: "Attempt to fix linting"

.github/workflows/tests.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,8 @@ jobs:
131131
with:
132132
install-project: "false"
133133

134-
- name: Import order (isort)
135-
run: poetry run isort --check --diff .
136-
137-
- name: Code style (black)
138-
run: poetry run black --check --diff .
139-
140-
- name: Semantic checks (ruff)
141-
# --quiet suppresses the update check.
142-
run: poetry run ruff check --quiet .
134+
- name: Check style
135+
run: poetry run ruff check --output-format=github .
143136

144137
lint-mypy:
145138
runs-on: ubuntu-latest

changelog.d/17620.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Replace `isort` and `black with `ruff`.

docs/code_style.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ errors in code.
88

99
The necessary tools are:
1010

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

1614
See [the contributing guide](development/contributing_guide.md#run-the-linters) for instructions

poetry.lock

Lines changed: 20 additions & 106 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)