Skip to content

Commit ff5f252

Browse files
[ruff] Add pydocstyle check (mostly autofix)
1 parent 92dac77 commit ff5f252

File tree

4 files changed

+31
-9
lines changed

4 files changed

+31
-9
lines changed

pyproject.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ line-length = 88
7474
format.docstring-code-format = true
7575
lint.select = [
7676
"B", # bugbear
77+
"D", # pydocstyle
7778
"E", # pycodestyle
7879
"F", # pyflakes
7980
"PGH004", # pygrep-hooks - Use specific rule codes when using noqa
@@ -84,9 +85,28 @@ lint.select = [
8485
"UP", # pyupgrade
8586
"W", # pycodestyle
8687
]
88+
8789
lint.ignore = [
8890
# bugbear ignore
8991
"B028", # No explicit `stacklevel` keyword argument found
92+
# pydocstyle ignore
93+
"D100", # Missing docstring in public module
94+
"D101", # Missing docstring in public class
95+
"D102", # Missing docstring in public method
96+
"D103", # Missing docstring in public function
97+
"D104", # Missing docstring in public package
98+
"D105", # Missing docstring in magic method
99+
"D106", # Missing docstring in public nested class
100+
"D107", # Missing docstring in `__init__`
101+
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
102+
"D205", # 1 blank line required between summary line and description
103+
"D209", # [*] Multi-line docstring closing quotes should be on a separate line
104+
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible.
105+
"D400", # First line should end with a period
106+
"D401", # First line of docstring should be in imperative mood
107+
"D402", # First line should not be the function's signature
108+
"D404", # First word of the docstring should not be "This"
109+
"D415", # First line should end with a period, question mark, or exclamation point
90110
]
91111

92112
[tool.pytest.ini_options]

pytest_asyncio/plugin.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,7 @@ def _preprocess_async_fixtures(
266266

267267

268268
def _synchronize_async_fixture(fixturedef: FixtureDef) -> None:
269-
"""
270-
Wraps the fixture function of an async fixture in a synchronous function.
271-
"""
269+
"""Wraps the fixture function of an async fixture in a synchronous function."""
272270
if inspect.isasyncgenfunction(fixturedef.func):
273271
_wrap_asyncgen_fixture(fixturedef)
274272
elif inspect.iscoroutinefunction(fixturedef.func):
@@ -908,9 +906,10 @@ def pytest_pyfunc_call(pyfuncitem: Function) -> Optional[object]:
908906
def wrap_in_sync(
909907
func: Callable[..., Awaitable[Any]],
910908
):
911-
"""Return a sync wrapper around an async function executing it in the
912-
current event loop."""
913-
909+
"""
910+
Return a sync wrapper around an async function executing it in the
911+
current event loop.
912+
"""
914913
# if the function is already wrapped, we rewrap using the original one
915914
# not using __wrapped__ because the original function may already be
916915
# a wrapped one

tests/hypothesis/test_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
"""Tests for the Hypothesis integration, which wraps async functions in a
1+
"""
2+
Tests for the Hypothesis integration, which wraps async functions in a
23
sync shim for Hypothesis.
34
"""
45

tests/test_simple.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ class TestMarkerInClassBasedTests:
7575

7676
@pytest.mark.asyncio
7777
async def test_asyncio_marker_with_implicit_loop_fixture(self):
78-
"""Test the "asyncio" marker works on a method in
79-
a class-based test with implicit loop fixture."""
78+
"""
79+
Test the "asyncio" marker works on a method in
80+
a class-based test with implicit loop fixture.
81+
"""
8082
ret = await async_coro()
8183
assert ret == "ok"
8284

0 commit comments

Comments
 (0)