Skip to content

Commit 3b36063

Browse files
committed
Lint
1 parent d971369 commit 3b36063

File tree

5 files changed

+58
-37
lines changed

5 files changed

+58
-37
lines changed

flake8_dunder_all/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ def _descend_node(node: ast.AST, attr: str = "body") -> Iterator[int]:
288288
def _is_type_checking(node: ast.AST) -> bool:
289289
"""
290290
Does the given ``if`` node indicate a `TYPE_CHECKING` block?
291+
292+
:param node:
291293
""" # noqa: D400
292294

293295
if isinstance(node, ast.Name) and node.id == "TYPE_CHECKING":

flake8_dunder_all/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ def get_docstring_lineno(node: Union[ast.FunctionDef, ast.ClassDef, ast.Module])
8181
def tidy_docstring(docstring: Optional[str]) -> str:
8282
"""
8383
Tidy up the docstring for use as help text.
84+
85+
:param docstring:
8486
"""
8587

8688
if docstring is None:

tests/test_flake8_dunder_all.py

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ def test_plugin_alphabetical(source: str, expects: Set[str], dunder_all_alphabet
206206
]
207207
)
208208
def test_plugin_alphabetical_ann_assign(
209-
source: str, expects: Set[str], dunder_all_alphabetical: AlphabeticalOptions
209+
source: str,
210+
expects: Set[str],
211+
dunder_all_alphabetical: AlphabeticalOptions,
210212
):
211213
plugin = Plugin(ast.parse(source))
212214
plugin.dunder_all_alphabetical = dunder_all_alphabetical
@@ -248,16 +250,25 @@ def test_plugin_alphabetical_tuple():
248250
pytest.param(testing_source_b, ["a_function"], False, 3, id="function no __all__"),
249251
pytest.param(testing_source_c, ["Foo"], False, 3, id="class no __all__"),
250252
pytest.param(
251-
testing_source_d, ["Foo", "a_function"], False, 3, id="function and class no __all__"
253+
testing_source_d,
254+
["Foo", "a_function"],
255+
False,
256+
3,
257+
id="function and class no __all__",
252258
),
253259
pytest.param(
254-
testing_source_e, ["Foo", "a_function"], True, 3, id="function and class with __all__"
260+
testing_source_e,
261+
["Foo", "a_function"],
262+
True,
263+
3,
264+
id="function and class with __all__",
255265
),
256266
pytest.param(
257-
testing_source_f, ["Foo", "a_function"],
267+
testing_source_f,
268+
["Foo", "a_function"],
258269
True,
259270
3,
260-
id="function and class with __all__ and extra variable"
271+
id="function and class with __all__ and extra variable",
261272
),
262273
pytest.param(testing_source_g, ["a_function"], False, 3, id="async function no __all__"),
263274
pytest.param(testing_source_h, [], False, 1, id="from import"),
@@ -285,16 +296,25 @@ def test_visitor(source: str, members: List[str], found_all: bool, last_import:
285296
pytest.param(testing_source_b, ["a_function"], False, 3, id="function no __all__"),
286297
pytest.param(testing_source_c, ["Foo"], False, 3, id="class no __all__"),
287298
pytest.param(
288-
testing_source_d, ["Foo", "a_function"], False, 3, id="function and class no __all__"
299+
testing_source_d,
300+
["Foo", "a_function"],
301+
False,
302+
3,
303+
id="function and class no __all__",
289304
),
290305
pytest.param(
291-
testing_source_e, ["Foo", "a_function"], True, 3, id="function and class with __all__"
306+
testing_source_e,
307+
["Foo", "a_function"],
308+
True,
309+
3,
310+
id="function and class with __all__",
292311
),
293312
pytest.param(
294-
testing_source_f, ["Foo", "a_function"],
313+
testing_source_f,
314+
["Foo", "a_function"],
295315
True,
296316
3,
297-
id="function and class with __all__ and extra variable"
317+
id="function and class with __all__ and extra variable",
298318
),
299319
pytest.param(testing_source_g, ["a_function"], False, 3, id="async function no __all__"),
300320
pytest.param(testing_source_h, [], False, 1, id="from import"),
@@ -306,10 +326,11 @@ def test_visitor(source: str, members: List[str], found_all: bool, last_import:
306326
pytest.param(if_type_checking_try_source, ["a_function"], False, 8, id="if TYPE_CHECKING try"),
307327
pytest.param(not_type_checking_if_source, ["a_function"], False, 2, id="not TYPE_CHECKING if"),
308328
pytest.param(
309-
if_type_checking_try_finally_source, ["a_function"],
329+
if_type_checking_try_finally_source,
330+
["a_function"],
310331
False,
311332
10,
312-
id="if TYPE_CHECKING try finally"
333+
id="if TYPE_CHECKING try finally",
313334
),
314335
]
315336
)
@@ -335,9 +356,10 @@ def test_visitor_endlineno(source: str, members: List[str], found_all: bool, las
335356
pytest.param(testing_source_d, ["Foo", "a_function"], 1, id="function and class no __all__"),
336357
pytest.param(testing_source_e, ["Foo", "a_function"], 0, id="function and class with __all__"),
337358
pytest.param(
338-
testing_source_f, ["Foo", "a_function"],
359+
testing_source_f,
360+
["Foo", "a_function"],
339361
0,
340-
id="function and class with __all__ and extra variable"
362+
id="function and class with __all__ and extra variable",
341363
),
342364
pytest.param(testing_source_g, ["a_function"], 1, id="async function no __all__"),
343365
pytest.param(testing_source_h, [], 0, id="from import"),
@@ -357,7 +379,7 @@ def test_check_and_add_all(
357379
source: str,
358380
members: List[str],
359381
ret: int,
360-
advanced_file_regression: AdvancedFileRegressionFixture
382+
advanced_file_regression: AdvancedFileRegressionFixture,
361383
):
362384
tmpfile = tmp_pathplus / "source.py"
363385
tmpfile.write_text(source)
@@ -386,9 +408,10 @@ def test_check_and_add_all(
386408
id="function and class with __all__",
387409
),
388410
pytest.param(
389-
testing_source_f_tuple, ["Foo", "a_function"],
411+
testing_source_f_tuple,
412+
["Foo", "a_function"],
390413
0,
391-
id="function and class with __all__ and extra variable"
414+
id="function and class with __all__ and extra variable",
392415
),
393416
pytest.param(testing_source_g, ["a_function"], 1, id="async function no __all__"),
394417
pytest.param(testing_source_h, [], 0, id="from import"),
@@ -404,7 +427,7 @@ def test_check_and_add_all_tuples(
404427
source: str,
405428
members: List[str],
406429
ret: int,
407-
advanced_file_regression: AdvancedFileRegressionFixture
430+
advanced_file_regression: AdvancedFileRegressionFixture,
408431
):
409432
tmpfile = tmp_pathplus / "source.py"
410433
tmpfile.write_text(source)

tests/test_main.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@
4040
pytest.param(testing_source_d, ["Foo", "a_function"], 1, id="function and class no __all__"),
4141
pytest.param(testing_source_e, ["Foo", "a_function"], 0, id="function and class with __all__"),
4242
pytest.param(
43-
testing_source_f, ["Foo", "a_function"],
43+
testing_source_f,
44+
["Foo", "a_function"],
4445
0,
45-
id="function and class with __all__ and extra variable"
46+
id="function and class with __all__ and extra variable",
4647
),
4748
pytest.param(testing_source_g, ["a_function"], 1, id="async function no __all__"),
4849
pytest.param(testing_source_h, [], 0, id="from import"),
@@ -116,9 +117,10 @@ def test_main_single_quotes(capsys, tmp_pathplus: PathPlus, source: str, members
116117
id="function and class with __all__",
117118
),
118119
pytest.param(
119-
testing_source_f_tuple, ["Foo", "a_function"],
120+
testing_source_f_tuple,
121+
["Foo", "a_function"],
120122
0,
121-
id="function and class with __all__ and extra variable"
123+
id="function and class with __all__ and extra variable",
122124
),
123125
pytest.param(testing_source_g, ["a_function"], 1, id="async function no __all__"),
124126
pytest.param(testing_source_h, [], 0, id="from import"),

tests/test_subprocess.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ def test_subprocess(tmp_pathplus: PathPlus, monkeypatch):
1717
with in_directory(tmp_pathplus):
1818
result = subprocess.run(
1919
[sys.executable, "-m", "flake8", "demo.py"],
20-
stdout=subprocess.PIPE,
21-
stderr=subprocess.PIPE,
20+
capture_output=True,
2221
)
2322

2423
assert result.returncode == 1
@@ -36,8 +35,7 @@ def test_subprocess(tmp_pathplus: PathPlus, monkeypatch):
3635
with in_directory(tmp_pathplus):
3736
result = subprocess.run(
3837
[sys.executable, "-m", "flake8", "demo.py", "--select", "DALL000"],
39-
stdout=subprocess.PIPE,
40-
stderr=subprocess.PIPE,
38+
capture_output=True,
4139
)
4240

4341
assert result.returncode == 1
@@ -53,8 +51,7 @@ def test_subprocess(tmp_pathplus: PathPlus, monkeypatch):
5351
with in_directory(tmp_pathplus):
5452
result = subprocess.run(
5553
[sys.executable, "-m", "flake8", "demo.py"],
56-
stdout=subprocess.PIPE,
57-
stderr=subprocess.PIPE,
54+
capture_output=True,
5855
)
5956

6057
assert result.returncode == 1
@@ -73,8 +70,7 @@ def test_subprocess(tmp_pathplus: PathPlus, monkeypatch):
7370
with in_directory(tmp_pathplus):
7471
result = subprocess.run(
7572
[sys.executable, "-m", "flake8", "demo.py"],
76-
stdout=subprocess.PIPE,
77-
stderr=subprocess.PIPE,
73+
capture_output=True,
7874
)
7975

8076
assert result.returncode == 0
@@ -93,8 +89,7 @@ def test_subprocess_noqa(tmp_pathplus: PathPlus, monkeypatch):
9389
with in_directory(tmp_pathplus):
9490
result = subprocess.run(
9591
[sys.executable, "-m", "flake8", "demo.py"],
96-
stdout=subprocess.PIPE,
97-
stderr=subprocess.PIPE,
92+
capture_output=True,
9893
)
9994

10095
assert result.returncode == 1
@@ -111,8 +106,7 @@ def test_subprocess_noqa(tmp_pathplus: PathPlus, monkeypatch):
111106
with in_directory(tmp_pathplus):
112107
result = subprocess.run(
113108
[sys.executable, "-m", "flake8", "demo.py", "--select", "DALL000"],
114-
stdout=subprocess.PIPE,
115-
stderr=subprocess.PIPE,
109+
capture_output=True,
116110
)
117111

118112
assert result.returncode == 0
@@ -128,8 +122,7 @@ def test_subprocess_noqa(tmp_pathplus: PathPlus, monkeypatch):
128122
with in_directory(tmp_pathplus):
129123
result = subprocess.run(
130124
[sys.executable, "-m", "flake8", "demo.py"],
131-
stdout=subprocess.PIPE,
132-
stderr=subprocess.PIPE,
125+
capture_output=True,
133126
)
134127

135128
assert result.returncode == 0
@@ -148,8 +141,7 @@ def test_subprocess_noqa(tmp_pathplus: PathPlus, monkeypatch):
148141
with in_directory(tmp_pathplus):
149142
result = subprocess.run(
150143
[sys.executable, "-m", "flake8", "demo.py"],
151-
stdout=subprocess.PIPE,
152-
stderr=subprocess.PIPE,
144+
capture_output=True,
153145
)
154146

155147
assert result.returncode == 0

0 commit comments

Comments
 (0)