Skip to content

Commit 7e92006

Browse files
BordaAlexWaygood
andauthored
Use Ruff for formatting as well as linting (#110)
Co-authored-by: Alex Waygood <[email protected]>
1 parent ce6d7ae commit 7e92006

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.1.6
3+
rev: v0.2.2
44
hooks:
55
- id: ruff
6-
args: [--fix, --exit-non-zero-on-fix]
7-
8-
- repo: https://github.com/psf/black-pre-commit-mirror
9-
rev: 23.11.0
10-
hooks:
11-
- id: black
6+
args: ["--exit-non-zero-on-fix"]
7+
- id: ruff-format
128

139
- repo: https://github.com/pre-commit/pre-commit-hooks
1410
rev: v4.5.0
@@ -24,13 +20,13 @@ repos:
2420
exclude: tests/fixtures/xfail/trailing-whitespaces.rst
2521

2622
- repo: https://github.com/tox-dev/pyproject-fmt
27-
rev: 1.5.1
23+
rev: 1.7.0
2824
hooks:
2925
- id: pyproject-fmt
3026
additional_dependencies: [tox]
3127

3228
- repo: https://github.com/abravalheri/validate-pyproject
33-
rev: v0.15
29+
rev: v0.16
3430
hooks:
3531
- id: validate-pyproject
3632

pyproject.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ packages = ["sphinxlint"]
5656
[tool.hatch.version.raw-options]
5757
local_scheme = "no-local-version"
5858

59-
[tool.black]
60-
6159
[tool.ruff]
60+
fix = true
61+
62+
[tool.ruff.lint]
6263
select = [
6364
"E", # pycodestyle errors
6465
"F", # pyflakes errors
6566
"I", # isort
66-
"ISC", # flake8-implicit-str-concat
6767
"PGH", # pygrep-hooks
6868
"RUF100", # unused noqa (yesqa)
6969
"UP", # pyupgrade
@@ -78,5 +78,8 @@ extend-ignore = [
7878
"UP038", # makes code slower and more verbose
7979
]
8080

81+
[tool.ruff.format]
82+
preview = true
83+
8184
[tool.pylint.variables]
8285
callbacks = ["check_"]

sphinxlint/checkers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ def check_line_too_long(file, lines, options=None):
445445
continue # ignore anonymous hyperlink targets
446446
if _is_very_long_string_literal(line):
447447
continue # ignore a very long literal string
448-
yield lno + 1, f"Line too long ({len(line)-1}/{options.max_line_length})"
448+
yield lno + 1, f"Line too long ({len(line) - 1}/{options.max_line_length})"
449449

450450

451451
@checker(".html", enabled=False, rst_only=False)

sphinxlint/rst.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- All constants are ALL_CAPS
55
- All compiled regexes are suffixed by _RE
66
"""
7+
78
from functools import lru_cache
89

910
import regex as re

sphinxlint/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Just a bunch of utility functions for sphinxlint."""
2+
23
from functools import lru_cache
34

45
import regex as re

0 commit comments

Comments
 (0)