Skip to content

Commit 0a2a386

Browse files
authored
Use the new ruff formatter over black (#3142)
1 parent c223cff commit 0a2a386

File tree

4 files changed

+25
-20
lines changed

4 files changed

+25
-20
lines changed

.pre-commit-config.yaml

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ repos:
44
hooks:
55
- id: end-of-file-fixer
66
- id: trailing-whitespace
7-
- repo: https://github.com/psf/black
8-
rev: 23.10.0
7+
- repo: https://github.com/astral-sh/ruff-pre-commit
8+
rev: v0.1.2
99
hooks:
10-
- id: black
10+
- id: ruff-format
1111
- repo: https://github.com/codespell-project/codespell
1212
rev: v2.2.6
1313
hooks:
1414
- id: codespell
1515
args: ["--ignore-words-list", "crate,releas", "--skip", "*.svg"]
1616
additional_dependencies:
17-
- tomli
17+
- tomli>=2.0.1
1818
- repo: https://github.com/tox-dev/tox-ini-fmt
1919
rev: 1.3.1
2020
hooks:
@@ -24,7 +24,7 @@ repos:
2424
rev: 1.2.0
2525
hooks:
2626
- id: pyproject-fmt
27-
additional_dependencies: ["tox>=4.10"]
27+
additional_dependencies: ["tox>=4.11.3"]
2828
- repo: https://github.com/pre-commit/mirrors-prettier
2929
rev: v3.0.3
3030
hooks:
@@ -34,12 +34,12 @@ repos:
3434
rev: 1.16.0
3535
hooks:
3636
- id: blacken-docs
37-
additional_dependencies: [black==23.7]
37+
additional_dependencies: [black==23.10.1]
3838
- repo: https://github.com/astral-sh/ruff-pre-commit
39-
rev: v0.1.1
39+
rev: v0.1.2
4040
hooks:
4141
- id: ruff
42-
args: [--fix, --exit-non-zero-on-fix]
42+
args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes]
4343
- repo: https://github.com/pre-commit/pygrep-hooks
4444
rev: v1.10.0
4545
hooks:

pyproject.toml

+9-3
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ build.hooks.vcs.version-file = "src/tox/version.py"
102102
build.targets.sdist.include = ["/src", "/tests", "/tox.ini"]
103103
version.source = "vcs"
104104

105-
[tool.black]
106-
line-length = 120
107-
108105
[tool.ruff]
109106
select = ["ALL"]
110107
line-length = 120
@@ -119,6 +116,15 @@ ignore = [
119116
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
120117
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
121118
"S104", # Possible binding to all interface
119+
"COM812", # conflicts with formatter
120+
"COM819", # conflicts with formatter
121+
"E501", # conflicts with formatter
122+
"ISC001", # conflicts with formatter
123+
"Q000", # conflicts with formatter
124+
"Q001", # conflicts with formatter
125+
"Q002", # conflicts with formatter
126+
"Q003", # conflicts with formatter
127+
"W191", # conflicts with formatter
122128
]
123129
[tool.ruff.per-file-ignores]
124130
"tests/**/*.py" = [

src/tox/config/of_type.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ def __eq__(self, o: object) -> bool:
116116
return (
117117
type(self) == type(o)
118118
and super().__eq__(o)
119-
and (self.of_type, self.default, self.post_process)
120-
== (o.of_type, o.default, o.post_process) # type: ignore[attr-defined]
119+
and (self.of_type, self.default, self.post_process) == (o.of_type, o.default, o.post_process) # type: ignore[attr-defined]
121120
)
122121

123122

tox.ini

+7-7
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ commands =
4141
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
4242
skip_install = true
4343
deps =
44-
pre-commit>=3.3.3
44+
pre-commit>=3.5
4545
pass_env =
4646
{[testenv]passenv}
4747
PROGRAMDATA
@@ -52,7 +52,7 @@ commands =
5252
[testenv:type]
5353
description = run type check on code base
5454
deps =
55-
mypy==1.5.1
55+
mypy==1.6.1
5656
types-cachetools>=5.3.0.6
5757
types-chardet>=5.0.4.6
5858
commands =
@@ -73,8 +73,8 @@ commands =
7373
description = check that the long description is valid
7474
skip_install = true
7575
deps =
76-
build[virtualenv]>=0.10
77-
check-wheel-contents>=0.4
76+
build[virtualenv]>=1.0.3
77+
check-wheel-contents>=0.5
7878
twine>=4.0.2
7979
commands =
8080
python -m build -o {envtmpdir} -s -w .
@@ -85,9 +85,9 @@ commands =
8585
description = do a release, required posarg of the version number
8686
skip_install = true
8787
deps =
88-
gitpython>=3.1.32
89-
packaging>=23.1
90-
towncrier>=23.6
88+
gitpython>=3.1.40
89+
packaging>=23.2
90+
towncrier>=23.10
9191
commands =
9292
python {toxinidir}/tasks/release.py --version {posargs}
9393

0 commit comments

Comments
 (0)