Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add filepaths checked to verbose msg #9375

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/whatsnew/fragments/9357.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The verbose option now outputs the filenames of the files that have been checked.
Previously, it only included the number of checked and skipped files.

Closes #9357
7 changes: 6 additions & 1 deletion pylint/lint/pylinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ def _lint_files(
continue
try:
self._lint_file(fileitem, module, check_astroid_module)
self.stats.modules_names.add(fileitem.filepath)
except Exception as ex: # pylint: disable=broad-except
template_path = prepare_crash_report(
ex, fileitem.filepath, self.crash_file_path
Expand Down Expand Up @@ -1141,7 +1142,11 @@ def _report_evaluation(self, verbose: bool = False) -> int | None:
if verbose:
checked_files_count = self.stats.node_count["module"]
unchecked_files_count = self.stats.undocumented["module"]
msg += f"\nChecked {checked_files_count} files, skipped {unchecked_files_count} files"
checked_files = ", ".join(self.stats.modules_names)
msg += (
f"\nChecked {checked_files_count} files ({checked_files}),"
f" skipped {unchecked_files_count} files"
)

if self.config.score:
sect = report_nodes.EvaluationSection(msg)
Expand Down
1 change: 1 addition & 0 deletions pylint/utils/linterstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def __init__(
self.code_type_count = code_type_count or CodeTypeCount(
code=0, comment=0, docstring=0, empty=0, total=0
)
self.modules_names: set[str] = set()

self.dependencies: dict[str, set[str]] = dependencies or {}
self.duplicated_lines = duplicated_lines or DuplicatedLines(
Expand Down
5 changes: 4 additions & 1 deletion tests/test_self.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,10 @@ def test_disable_all(self) -> None:
def test_output_with_verbose(self) -> None:
out = StringIO()
self._runtest([UNNECESSARY_LAMBDA, "--verbose"], out=out, code=4)
assert "Checked 1 files, skipped 0 files" in out.getvalue().strip()
stripped = out.getvalue().strip()
assert "Checked 1 files" in stripped
assert "unnecessary_lambda.py" in stripped
assert "skipped 0 files" in stripped

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