Skip to content

Commit 4471242

Browse files
qequPierre-SassoulasjacobtylerwallsDanielNoord
authored
[Feature] Add filepaths checked to verbose msg (#9375)
Signed-off-by: Alvaro Frias Garay <alvarofriasgaray@gmail.com> Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com> Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com> Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
1 parent 4847314 commit 4471242

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

doc/whatsnew/fragments/9357.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
The verbose option now outputs the filenames of the files that have been checked.
2+
Previously, it only included the number of checked and skipped files.
3+
4+
Closes #9357

pylint/lint/pylinter.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,7 @@ def _lint_files(
764764
continue
765765
try:
766766
self._lint_file(fileitem, module, check_astroid_module)
767+
self.stats.modules_names.add(fileitem.filepath)
767768
except Exception as ex: # pylint: disable=broad-except
768769
template_path = prepare_crash_report(
769770
ex, fileitem.filepath, self.crash_file_path
@@ -1161,7 +1162,12 @@ def _report_evaluation(self, verbose: bool = False) -> int | None:
11611162

11621163
if verbose:
11631164
checked_files_count = self.stats.node_count["module"]
1164-
msg += f"\nChecked {checked_files_count} files, skipped {self.stats.skipped} files/modules"
1165+
unchecked_files_count = self.stats.undocumented["module"]
1166+
checked_files = ", ".join(self.stats.modules_names)
1167+
msg += (
1168+
f"\nChecked {checked_files_count} files/modules ({checked_files}),"
1169+
f" skipped {unchecked_files_count} files/modules"
1170+
)
11651171

11661172
if self.config.score:
11671173
sect = report_nodes.EvaluationSection(msg)

pylint/utils/linterstats.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def __init__(
109109
self.code_type_count = code_type_count or CodeTypeCount(
110110
code=0, comment=0, docstring=0, empty=0, total=0
111111
)
112+
self.modules_names: set[str] = set()
112113

113114
self.dependencies: dict[str, set[str]] = dependencies or {}
114115
self.duplicated_lines = duplicated_lines or DuplicatedLines(

tests/test_self.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,10 @@ def test_output_with_verbose(self) -> None:
257257
out=out,
258258
code=4,
259259
)
260-
assert "Checked 1 files, skipped 1 files/modules" in out.getvalue().strip()
260+
stripped = out.getvalue().strip()
261+
assert "Checked 1 files/modules" in stripped
262+
assert "unnecessary_lambda.py" in stripped
263+
assert "skipped 0 files/modules" in stripped
261264

262265
def test_no_out_encoding(self) -> None:
263266
"""Test redirection of stdout with non ascii characters."""

0 commit comments

Comments
 (0)