From d53781204a830b4c19a7eec2042fffa2fc46ac6b Mon Sep 17 00:00:00 2001 From: Alvaro Frias Garay Date: Sun, 21 Jan 2024 23:57:01 -0300 Subject: [PATCH 1/7] Add filepaths checked to verbose msg Signed-off-by: Alvaro Frias Garay --- pylint/lint/pylinter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py index 30250154e6..e7003765b2 100644 --- a/pylint/lint/pylinter.py +++ b/pylint/lint/pylinter.py @@ -355,6 +355,7 @@ def __init__( self.current_file: str | None = None self._ignore_file = False self._ignore_paths: list[Pattern[str]] = [] + self._files_checked = set() self.register_checker(self) @@ -749,6 +750,7 @@ def _lint_files( continue try: self._lint_file(fileitem, module, check_astroid_module) + self._files_checked.add(fileitem.filepath) except Exception as ex: # pylint: disable=broad-except template_path = prepare_crash_report( ex, fileitem.filepath, self.crash_file_path @@ -1141,7 +1143,8 @@ 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._files_checked) + msg += f"\nChecked {checked_files_count} files ({checked_files}), skipped {unchecked_files_count} files" if self.config.score: sect = report_nodes.EvaluationSection(msg) From 4d37616e3a8d17bee3837279b96bc39905aa78d0 Mon Sep 17 00:00:00 2001 From: Alvaro Frias Garay Date: Thu, 25 Jan 2024 22:34:29 -0300 Subject: [PATCH 2/7] move modules names set to LinterStats Signed-off-by: Alvaro Frias Garay --- pylint/lint/pylinter.py | 5 ++--- pylint/utils/linterstats.py | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py index e7003765b2..1ce4d91a20 100644 --- a/pylint/lint/pylinter.py +++ b/pylint/lint/pylinter.py @@ -355,7 +355,6 @@ def __init__( self.current_file: str | None = None self._ignore_file = False self._ignore_paths: list[Pattern[str]] = [] - self._files_checked = set() self.register_checker(self) @@ -750,7 +749,7 @@ def _lint_files( continue try: self._lint_file(fileitem, module, check_astroid_module) - self._files_checked.add(fileitem.filepath) + 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 @@ -1143,7 +1142,7 @@ 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"] - checked_files = ', '.join(self._files_checked) + checked_files = ", ".join(self.stats.modules_names) msg += f"\nChecked {checked_files_count} files ({checked_files}), skipped {unchecked_files_count} files" if self.config.score: diff --git a/pylint/utils/linterstats.py b/pylint/utils/linterstats.py index e7a088b7bb..7d91be5703 100644 --- a/pylint/utils/linterstats.py +++ b/pylint/utils/linterstats.py @@ -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( From f83570d9c7dc14c5a8044daf235938db032141a0 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Fri, 3 May 2024 22:27:29 +0200 Subject: [PATCH 3/7] Add fragment --- doc/whatsnew/fragments/9357.feature | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 doc/whatsnew/fragments/9357.feature diff --git a/doc/whatsnew/fragments/9357.feature b/doc/whatsnew/fragments/9357.feature new file mode 100644 index 0000000000..748ce4035d --- /dev/null +++ b/doc/whatsnew/fragments/9357.feature @@ -0,0 +1,4 @@ +The verbose option now output the filenames of the files that have been checked. +Previously, it only included the number of checked and skipped files. + +Closes #9357 From b1f6ab3c0841393cbf678381ea7f64e582cd5214 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Fri, 3 May 2024 22:32:24 +0200 Subject: [PATCH 4/7] Fix line too long --- pylint/lint/pylinter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py index 1ce4d91a20..a9779f6cd2 100644 --- a/pylint/lint/pylinter.py +++ b/pylint/lint/pylinter.py @@ -1143,7 +1143,10 @@ def _report_evaluation(self, verbose: bool = False) -> int | None: checked_files_count = self.stats.node_count["module"] unchecked_files_count = self.stats.undocumented["module"] checked_files = ", ".join(self.stats.modules_names) - msg += f"\nChecked {checked_files_count} files ({checked_files}), skipped {unchecked_files_count} files" + msg += ( + f"\nChecked {checked_files_count} files ({checked_files})," + f" skipped {unchecked_files_count} files" + ) if self.config.score: sect = report_nodes.EvaluationSection(msg) From 0b8ba5e07aa62ea537efff033b281c6c2b00034a Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Sun, 12 May 2024 11:23:54 -0400 Subject: [PATCH 5/7] Adjust existing test --- tests/test_self.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_self.py b/tests/test_self.py index 0291e9c5ec..51d546579a 100644 --- a/tests/test_self.py +++ b/tests/test_self.py @@ -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.""" From 2a40abb82a2912e0568f0ee827cc953b598c13b1 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Sun, 12 May 2024 11:27:39 -0400 Subject: [PATCH 6/7] grammar --- doc/whatsnew/fragments/9357.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whatsnew/fragments/9357.feature b/doc/whatsnew/fragments/9357.feature index 748ce4035d..fda71dd0aa 100644 --- a/doc/whatsnew/fragments/9357.feature +++ b/doc/whatsnew/fragments/9357.feature @@ -1,4 +1,4 @@ -The verbose option now output the filenames of the files that have been checked. +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 From f6d7a216ff83b790da62407eeed7ec2352c4b8b0 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Sun, 12 May 2024 11:35:10 -0400 Subject: [PATCH 7/7] fix assertion --- tests/test_self.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_self.py b/tests/test_self.py index 51d546579a..d81a9d718b 100644 --- a/tests/test_self.py +++ b/tests/test_self.py @@ -225,7 +225,7 @@ def test_output_with_verbose(self) -> None: stripped = out.getvalue().strip() assert "Checked 1 files" in stripped assert "unnecessary_lambda.py" in stripped - assert "Skipped 0 files" in stripped + assert "skipped 0 files" in stripped def test_no_out_encoding(self) -> None: """Test redirection of stdout with non ascii characters."""