Skip to content

Commit

Permalink
Migrate to ruff
Browse files Browse the repository at this point in the history
As #360 shows, black and reorder-python-imports conflict on how they format imports.

Switch over to `ruff` + its builtin import sorter (isort).
  • Loading branch information
nicoddemus committed Feb 4, 2025
1 parent 4a3ad24 commit 7e6d431
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
19 changes: 6 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,13 @@ exclude: |
default_language_version:
python: python3.10
repos:
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.9.4
hooks:
- id: reorder-python-imports
args:
- --application-directories=.:src
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
args:
- --safe
- --quiet
language_version: python3
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
Expand Down
27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,30 @@ requires = [
"wheel",
]
build-backend = "setuptools.build_meta"

[tool.ruff]
target-version = "py310"
src = [
"src",
"tests",
]
format.docstring-code-format = true
lint.select = ['E4', 'E7', 'E9', 'F', 'I']
lint.ignore = [
"E402",
"E711",
"E712",
"E721",
"E722",
"E731",
"E741",
"F401",
"F403",
"F405",
"F507",
"F601",
"F722",
"F811",
"F821",
"F841",
]

0 comments on commit 7e6d431

Please sign in to comment.