Skip to content

Commit b8c6c15

Browse files
Use the ruff formatter (jaraco/skeleton#99)
* Use the ruff formatter, instead of black Based on: - ruff-pre-commit README.md | Using Ruff with pre-commit https://github.com/astral-sh/ruff-pre-commit/blob/main/README.md - The Ruff Formatter | Conflicting lint rules https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules Support for the ruff formatter was added to pytest-ruff by commits from October 2023, released the same day as versions 0.2 and 0.2.1. Hence, it makes sense to require pytest-ruff ≥ 0.2.1 now. Support for `quote-style = "preserve"` was added to ruff in the last couple of weeks, therefore require the latest version, ruff ≥ 0.1.8. This option is equivalent to `skip-string-normalization` in black. Closes jaraco/skeleton#101. --------- Co-authored-by: Jason R. Coombs <[email protected]>
1 parent 596e683 commit b8c6c15

File tree

6 files changed

+27
-22
lines changed

6 files changed

+27
-22
lines changed

.pre-commit-config.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 22.6.0
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.1.8
44
hooks:
5-
- id: black
5+
- id: ruff
6+
- id: ruff-format

README.rst

-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
:target: https://github.com/astral-sh/ruff
1212
:alt: Ruff
1313

14-
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
15-
:target: https://github.com/psf/black
16-
:alt: Code style: Black
17-
1814
.. .. image:: https://readthedocs.org/projects/PROJECT_RTD/badge/?version=latest
1915
.. :target: https://PROJECT_RTD.readthedocs.io/en/latest/?badge=latest
2016

pyproject.toml

-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,4 @@
22
requires = ["setuptools>=56", "setuptools_scm[toml]>=3.4.1"]
33
build-backend = "setuptools.build_meta"
44

5-
[tool.black]
6-
skip-string-normalization = true
7-
85
[tool.setuptools_scm]

pytest.ini

-8
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ filterwarnings=
77
# Ensure ResourceWarnings are emitted
88
default::ResourceWarning
99

10-
# shopkeep/pytest-black#55
11-
ignore:<class 'pytest_black.BlackItem'> is not using a cooperative constructor:pytest.PytestDeprecationWarning
12-
ignore:The \(fspath. py.path.local\) argument to BlackItem is deprecated.:pytest.PytestDeprecationWarning
13-
ignore:BlackItem is an Item subclass and should not be a collector:pytest.PytestWarning
14-
15-
# shopkeep/pytest-black#67
16-
ignore:'encoding' argument not specified::pytest_black
17-
1810
# realpython/pytest-mypy#152
1911
ignore:'encoding' argument not specified::pytest_mypy
2012

ruff.toml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[lint]
2+
extend-ignore = [
3+
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
4+
"W191",
5+
"E111",
6+
"E114",
7+
"E117",
8+
"D206",
9+
"D300",
10+
"Q000",
11+
"Q001",
12+
"Q002",
13+
"Q003",
14+
"COM812",
15+
"COM819",
16+
"ISC001",
17+
"ISC002",
18+
]
19+
20+
[format]
21+
# https://docs.astral.sh/ruff/settings/#format-quote-style
22+
quote-style = "preserve"

setup.cfg

+1-4
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,12 @@ testing =
3030
# upstream
3131
pytest >= 6
3232
pytest-checkdocs >= 2.4
33-
pytest-black >= 0.3.7; \
34-
# workaround for jaraco/skeleton#22
35-
python_implementation != "PyPy"
3633
pytest-cov
3734
pytest-mypy; \
3835
# workaround for jaraco/skeleton#22
3936
python_implementation != "PyPy"
4037
pytest-enabler >= 2.2
41-
pytest-ruff
38+
pytest-ruff >= 0.2.1
4239

4340
# local
4441

0 commit comments

Comments
 (0)