Skip to content

Commit bfdfb85

Browse files
vfaziouSpike
authored andcommitted
lint: migrate to ruff
1 parent 4d6a987 commit bfdfb85

File tree

2 files changed

+16
-60
lines changed

2 files changed

+16
-60
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
default_stages: ["commit", "push"]
1+
default_stages: ["pre-commit", "pre-push"]
22
repos:
33

44
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -17,24 +17,15 @@ repos:
1717
- id: trailing-whitespace
1818
args: ["--markdown-linebreak-ext=md"]
1919

20-
- repo: https://github.com/pycqa/isort
21-
rev: 6.0.1
20+
- repo: https://github.com/astral-sh/ruff-pre-commit
21+
# Ruff version.
22+
rev: v0.11.4
2223
hooks:
23-
- id: isort
24-
name: isort (python)
25-
- id: isort
26-
name: isort (cython)
27-
types: ["cython"]
28-
29-
- repo: https://github.com/psf/black-pre-commit-mirror
30-
rev: 25.1.0
31-
hooks:
32-
- id: black
33-
34-
- repo: https://github.com/flakeheaven/flakeheaven
35-
rev: 3.3.0
36-
hooks:
37-
- id: flakeheaven
24+
# Run the linter.
25+
- id: ruff
26+
args: [ --fix ]
27+
# Run the formatter.
28+
- id: ruff-format
3829

3930
# Run mypy locally to reuse poetry dev environment
4031
- repo: local

pyproject.toml

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -45,51 +45,16 @@ show_column_numbers = true
4545
show_error_codes = true
4646
files = "src/**/*.py"
4747

48-
[tool.black]
48+
[tool.ruff]
4949
line-length = 120
50-
target-version = ['py39']
51-
include = '\.pyi?$'
52-
exclude = '''
53-
/(
54-
\.eggs
55-
| \.git
56-
| \.hg
57-
| \.mypy_cache
58-
| \.tox
59-
| \.venv
60-
| _build
61-
| buck-out
62-
| build
63-
| dist
64-
)/
65-
'''
6650

67-
[tool.isort]
68-
profile = "black"
69-
line_length = 120
51+
[tool.ruff.lint]
52+
select = ["A", "B", "C4", "ERA", "F", "I", "PT", "S"]
53+
ignore = ["A002", "B9", "PT011", "PT012"]
7054

71-
[tool.flakeheaven]
72-
format = "colored"
73-
show_source = true
74-
max_line_length = 120
75-
76-
[tool.flakeheaven.plugins]
77-
# Ignore redefinition of variable name in new scope
78-
pyflakes = ["+*", "-F823"]
79-
flake8-bandit = ["+*"]
80-
flake8-bugbear = ["+*"]
81-
flake8-builtins = ["+*"]
82-
flake8-comprehensions = ["+*"]
83-
flake8-darglint = ["+*"]
84-
flake8-docstrings = ["+*"]
85-
flake8-eradicate = ["+*"]
86-
flake8-mutable = ["+*"]
87-
flake8-pytest-style = ["+*"]
88-
flake8-spellcheck = ["+*"]
89-
90-
[tool.flakeheaven.exceptions."**/__init__.py"]
91-
# Ignore unused imports in __init__.py files
92-
pyflakes = ["-F401"]
55+
[tool.ruff.lint.per-file-ignores]
56+
"__init__.py" = ["F401"]
57+
"tests/**.py" = ["S101"]
9358

9459
[tool.pytest.ini_options]
9560
testpaths = ["tests"]

0 commit comments

Comments
 (0)