Skip to content

Commit c6dbd05

Browse files
committed
chore(ruff) Fix strict linting issues (ruff 0.7.0)
Fixed 12 errors: - docs/conf.py: 2 × UP031 (printf-string-formatting) - src/doctest_docutils.py: 4 × UP031 (printf-string-formatting) 3 × UP032 (f-string) - src/pytest_doctest_docutils.py: 1 × I001 (unsorted-imports) - tests/conftest.py: 1 × PT001 (pytest-fixture-incorrect-parentheses-style) - tests/test_doctest_docutils.py: 1 × I001 (unsorted-imports) Found 219 errors (12 fixed, 205 remaining). 1 file reformatted, 10 files left unchanged
1 parent bdd360a commit c6dbd05

File tree

5 files changed

+20
-17
lines changed

5 files changed

+20
-17
lines changed

docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
project = about["__title__"]
5757
project_copyright = about["__copyright__"]
5858

59-
version = "%s" % (".".join(about["__version__"].split("."))[:2])
60-
release = "%s" % (about["__version__"])
59+
version = "{}".format(".".join(about["__version__"].split("."))[:2])
60+
release = "{}".format(about["__version__"])
6161

6262
exclude_patterns = ["_build"]
6363

src/doctest_docutils.py

+14-13
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ def run(self) -> t.List[Node]:
104104
prefix, option_name = option[0], option[1:]
105105
if prefix not in "+-":
106106
self.state.document.reporter.warning(
107-
"missing '+' or '-' in '%s' option." % option,
107+
f"missing '+' or '-' in '{option}' option.",
108108
line=self.lineno,
109109
)
110110
continue
111111
if option_name not in doctest.OPTIONFLAGS_BY_NAME:
112112
self.state.document.reporter.warning(
113-
"'%s' is not a valid option." % option_name,
113+
f"'{option_name}' is not a valid option.",
114114
line=self.lineno,
115115
)
116116
continue
@@ -125,7 +125,7 @@ def run(self) -> t.List[Node]:
125125
node["options"][flag] = True # Skip the test
126126
except InvalidSpecifier:
127127
self.state.document.reporter.warning(
128-
"'%s' is not a valid pyversion option" % spec,
128+
f"'{spec}' is not a valid pyversion option",
129129
line=self.lineno,
130130
)
131131
if "skipif" in self.options:
@@ -288,16 +288,17 @@ def _find(
288288

289289
# Find a test for this string, and add it to the list of tests.
290290
logger.debug(
291-
"_find(%s)"
292-
% pprint.pformat(
293-
{
294-
"tests": tests,
295-
"string": string,
296-
"name": name,
297-
"source_lines": source_lines,
298-
"globs": globs,
299-
"seen": seen,
300-
},
291+
"_find({})".format(
292+
pprint.pformat(
293+
{
294+
"tests": tests,
295+
"string": string,
296+
"name": name,
297+
"source_lines": source_lines,
298+
"globs": globs,
299+
"seen": seen,
300+
},
301+
)
301302
),
302303
)
303304
ext = pathlib.Path(name).suffix

src/pytest_doctest_docutils.py

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import pytest
2323
from _pytest import outcomes
2424
from _pytest.outcomes import OutcomeException
25+
2526
from doctest_docutils import DocutilsDocTestFinder, setup
2627

2728
if t.TYPE_CHECKING:

tests/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __call__(
3333
...
3434

3535

36-
@pytest.fixture()
36+
@pytest.fixture
3737
def make_app_params(
3838
request: pytest.FixtureRequest,
3939
app_params: AppParams,

tests/test_doctest_docutils.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
import textwrap
66
import typing as t
77

8-
import doctest_docutils
98
import pytest
109

10+
import doctest_docutils
11+
1112
FixtureFileDict = t.Dict[str, str]
1213

1314

0 commit comments

Comments
 (0)