Skip to content

Commit 733c0f3

Browse files
MNT: blue/isort/flake8 → ruff
1 parent c445edd commit 733c0f3

File tree

3 files changed

+38
-37
lines changed

3 files changed

+38
-37
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,14 @@ repos:
1212
- id: check-case-conflict
1313
- id: check-merge-conflict
1414
- id: check-vcs-permalinks
15-
- repo: https://github.com/grantjenks/blue
16-
rev: v0.9.1
15+
- repo: https://github.com/astral-sh/ruff-pre-commit
16+
rev: v0.1.9
1717
hooks:
18-
- id: blue
19-
- repo: https://github.com/pycqa/isort
20-
rev: 5.12.0
21-
hooks:
22-
- id: isort
23-
- repo: https://github.com/pycqa/flake8
24-
rev: 6.1.0
25-
hooks:
26-
- id: flake8
27-
exclude: "^(doc|nisext|tools)/"
18+
- id: ruff
19+
args: [--fix, --show-fix, --exit-non-zero-on-fix]
20+
exclude: = ["doc", "tools"]
21+
- id: ruff-format
22+
exclude: = ["doc", "tools"]
2823
- repo: https://github.com/pre-commit/mirrors-mypy
2924
rev: v1.5.1
3025
hooks:

pyproject.toml

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,32 @@ __version__ = version = {version!r}
109109
__version_tuple__ = version_tuple = {version_tuple!r}
110110
'''
111111

112-
[tool.blue]
113-
line_length = 99
114-
target-version = ["py38"]
115-
force-exclude = """
116-
(
117-
_version.py
118-
| nibabel/externals/
119-
| versioneer.py
120-
)
121-
"""
112+
[tool.ruff]
113+
line-length = 99
114+
exclude = ["doc", "nibabel/externals", "tools", "version.py", "versioneer.py"]
122115

123-
[tool.isort]
124-
profile = "black"
125-
line_length = 99
126-
extend_skip = ["_version.py", "externals"]
116+
[tool.ruff.lint]
117+
select = ["F", "I", "Q"]
118+
ignore = [
119+
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
120+
"W191",
121+
"E111",
122+
"E114",
123+
"E117",
124+
"D206",
125+
"D300",
126+
"Q000",
127+
"Q001",
128+
"Q002",
129+
"Q003",
130+
"COM812",
131+
"COM819",
132+
"ISC001",
133+
"ISC002",
134+
]
135+
136+
[tool.ruff.format]
137+
quote-style = "single"
127138

128139
[tool.mypy]
129140
python_version = "3.11"

tox.ini

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -139,26 +139,21 @@ commands =
139139
description = Check our style guide
140140
labels = check
141141
deps =
142-
flake8
143-
blue
144-
# Broken extras, remove when fix is released
145-
isort[colors]!=5.13.1
142+
ruff>=0.1.9
146143
skip_install = true
147144
commands =
148-
blue --check --diff --color nibabel
149-
isort --check --diff --color nibabel
150-
flake8 nibabel
145+
ruff --diff nibabel
146+
ruff format --diff nibabel
151147

152148
[testenv:style-fix]
153149
description = Auto-apply style guide to the extent possible
154150
labels = pre-release
155151
deps =
156-
blue
157-
isort
152+
ruff
158153
skip_install = true
159154
commands =
160-
blue nibabel
161-
isort nibabel
155+
ruff --fix nibabel
156+
ruff format nibabel
162157

163158
[testenv:spellcheck]
164159
description = Check spelling

0 commit comments

Comments
 (0)