Skip to content

Commit

Permalink
Use the new ruff formatter over black (#3142)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat authored Oct 24, 2023
1 parent c223cff commit 0a2a386
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ repos:
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.10.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.2
hooks:
- id: black
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args: ["--ignore-words-list", "crate,releas", "--skip", "*.svg"]
additional_dependencies:
- tomli
- tomli>=2.0.1
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 1.3.1
hooks:
Expand All @@ -24,7 +24,7 @@ repos:
rev: 1.2.0
hooks:
- id: pyproject-fmt
additional_dependencies: ["tox>=4.10"]
additional_dependencies: ["tox>=4.11.3"]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
hooks:
Expand All @@ -34,12 +34,12 @@ repos:
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.7]
additional_dependencies: [black==23.10.1]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.1
rev: v0.1.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
Expand Down
12 changes: 9 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ build.hooks.vcs.version-file = "src/tox/version.py"
build.targets.sdist.include = ["/src", "/tests", "/tox.ini"]
version.source = "vcs"

[tool.black]
line-length = 120

[tool.ruff]
select = ["ALL"]
line-length = 120
Expand All @@ -119,6 +116,15 @@ ignore = [
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
"S104", # Possible binding to all interface
"COM812", # conflicts with formatter
"COM819", # conflicts with formatter
"E501", # conflicts with formatter
"ISC001", # conflicts with formatter
"Q000", # conflicts with formatter
"Q001", # conflicts with formatter
"Q002", # conflicts with formatter
"Q003", # conflicts with formatter
"W191", # conflicts with formatter
]
[tool.ruff.per-file-ignores]
"tests/**/*.py" = [
Expand Down
3 changes: 1 addition & 2 deletions src/tox/config/of_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ def __eq__(self, o: object) -> bool:
return (
type(self) == type(o)
and super().__eq__(o)
and (self.of_type, self.default, self.post_process)
== (o.of_type, o.default, o.post_process) # type: ignore[attr-defined]
and (self.of_type, self.default, self.post_process) == (o.of_type, o.default, o.post_process) # type: ignore[attr-defined]
)


Expand Down
14 changes: 7 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ commands =
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
skip_install = true
deps =
pre-commit>=3.3.3
pre-commit>=3.5
pass_env =
{[testenv]passenv}
PROGRAMDATA
Expand All @@ -52,7 +52,7 @@ commands =
[testenv:type]
description = run type check on code base
deps =
mypy==1.5.1
mypy==1.6.1
types-cachetools>=5.3.0.6
types-chardet>=5.0.4.6
commands =
Expand All @@ -73,8 +73,8 @@ commands =
description = check that the long description is valid
skip_install = true
deps =
build[virtualenv]>=0.10
check-wheel-contents>=0.4
build[virtualenv]>=1.0.3
check-wheel-contents>=0.5
twine>=4.0.2
commands =
python -m build -o {envtmpdir} -s -w .
Expand All @@ -85,9 +85,9 @@ commands =
description = do a release, required posarg of the version number
skip_install = true
deps =
gitpython>=3.1.32
packaging>=23.1
towncrier>=23.6
gitpython>=3.1.40
packaging>=23.2
towncrier>=23.10
commands =
python {toxinidir}/tasks/release.py --version {posargs}

Expand Down

0 comments on commit 0a2a386

Please sign in to comment.