From b679c5250229d91b3c0623f300835d631e479337 Mon Sep 17 00:00:00 2001 From: Meltem Kenis Date: Thu, 5 Oct 2023 21:23:16 +0100 Subject: [PATCH 01/11] update pylint file for listing statistics in verbose --- pylint/lint/pylinter.py | 11 ++++++++--- pylint/lint/run.py | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py index e21d8b5d97..3fc3e59ed5 100644 --- a/pylint/lint/pylinter.py +++ b/pylint/lint/pylinter.py @@ -1080,7 +1080,7 @@ def open(self) -> None: ) self.stats.reset_message_count() - def generate_reports(self) -> int | None: + def generate_reports(self, verbose: bool = False) -> int | None: """Close the whole package /module, it's time to make reports ! if persistent run, pickle results for later comparison @@ -1098,7 +1098,7 @@ def generate_reports(self) -> int | None: if self.config.reports: self.reporter.display_reports(sect) - score_value = self._report_evaluation() + score_value = self._report_evaluation(verbose) # save results if persistent run if self.config.persistent: save_results(self.stats, self.file_state.base_name) @@ -1107,7 +1107,7 @@ def generate_reports(self) -> int | None: score_value = None return score_value - def _report_evaluation(self) -> int | None: + def _report_evaluation(self, verbose: bool = False) -> int | None: """Make the global evaluation report.""" # check with at least a statement (usually 0 when there is a # syntax error preventing pylint from further processing) @@ -1139,6 +1139,11 @@ def _report_evaluation(self) -> int | None: if pnote is not None: msg += f" (previous run: {pnote:.2f}/10, {note - pnote:+.2f})" + 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" + if self.config.score: sect = report_nodes.EvaluationSection(msg) self.reporter.display_reports(sect) diff --git a/pylint/lint/run.py b/pylint/lint/run.py index e7a0fde8e6..1a8d594a04 100644 --- a/pylint/lint/run.py +++ b/pylint/lint/run.py @@ -203,13 +203,13 @@ def __init__( with open(self._output, "w", encoding="utf-8") as output: linter.reporter.out = output linter.check(args) - score_value = linter.generate_reports() + score_value = linter.generate_reports(verbose=self.verbose) except OSError as ex: print(ex, file=sys.stderr) sys.exit(32) else: linter.check(args) - score_value = linter.generate_reports() + score_value = linter.generate_reports(verbose=self.verbose) if linter.config.clear_cache_post_run: clear_lru_caches() MANAGER.clear_cache() From 8c7152429e0e2ff6b768698fe3b3c02275c2f419 Mon Sep 17 00:00:00 2001 From: Meltem Kenis Date: Sun, 8 Oct 2023 22:08:51 +0100 Subject: [PATCH 02/11] add test_output_with_verbose unittest --- tests/test_self.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_self.py b/tests/test_self.py index 159d3960e1..023fbd8c99 100644 --- a/tests/test_self.py +++ b/tests/test_self.py @@ -218,6 +218,11 @@ def test_disable_all(self) -> None: self._runtest([UNNECESSARY_LAMBDA, "--disable=all"], out=out, code=32) assert "No files to lint: exiting." in out.getvalue().strip() + 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() + def test_no_out_encoding(self) -> None: """Test redirection of stdout with non ascii characters.""" # This test reproduces bug #48066 ; it happens when stdout is redirected From fd281d37116a911f822c7293e2a2f061b908836a Mon Sep 17 00:00:00 2001 From: Meltem Kenis Date: Wed, 8 Nov 2023 21:13:48 +0000 Subject: [PATCH 03/11] update release notes with towncrier --- .idea/workspace.xml | 62 ++++++++++++++++++++++++++++++++++++ doc/whatsnew/3/3.1/index.rst | 26 ++++++++++++++- 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000000..d1f6218d5e --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + { + "keyToString": { + "RunOnceActivity.OpenProjectViewOnStart": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "WebServerToolWindowFactoryState": "false", + "node.js.detected.package.eslint": "true", + "node.js.detected.package.stylelint": "true", + "node.js.selected.package.eslint": "(autodetect)", + "node.js.selected.package.stylelint": "", + "nodejs_package_manager_path": "npm" + } +} + + + + + 1696881387406 + + + + + + + + + \ No newline at end of file diff --git a/doc/whatsnew/3/3.1/index.rst b/doc/whatsnew/3/3.1/index.rst index 37ddab5759..96bf3b88f7 100644 --- a/doc/whatsnew/3/3.1/index.rst +++ b/doc/whatsnew/3/3.1/index.rst @@ -12,5 +12,29 @@ Summary -- Release highlights ============================= - .. towncrier release notes start + +What's new in Pylint 3.1.0? +--------------------------- +Release date: 2023-11-08 + + +False Positives Fixed +--------------------- + +- Fixed false positive for ``inherit-non-class`` for generic Protocols. + + Closes #9106 (`#9106 `_) + + + +Other Changes +------------- + +- Fix a crash when an enum class which is also decorated with a ``dataclasses.dataclass`` decorator is defined. + + Closes #9100 (`#9100 `_) + +- Printing how many files were checked in verbose. + + Closes #8935 (`#8935 `_) From 43fc399a97b74ee13cfd14062a62617582fcc165 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 8 Nov 2023 21:15:19 +0000 Subject: [PATCH 04/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .idea/workspace.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d1f6218d5e..cdc20ff600 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -59,4 +59,4 @@ - \ No newline at end of file + From b1bac127c99ea6d07030bbc97209a20b96c0f9ca Mon Sep 17 00:00:00 2001 From: Meltem Kenis Date: Wed, 8 Nov 2023 21:16:03 +0000 Subject: [PATCH 05/11] Delete .idea --- .idea/workspace.xml | 62 --------------------------------------------- 1 file changed, 62 deletions(-) delete mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index cdc20ff600..0000000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - { - "keyToString": { - "RunOnceActivity.OpenProjectViewOnStart": "true", - "RunOnceActivity.ShowReadmeOnStart": "true", - "WebServerToolWindowFactoryState": "false", - "node.js.detected.package.eslint": "true", - "node.js.detected.package.stylelint": "true", - "node.js.selected.package.eslint": "(autodetect)", - "node.js.selected.package.stylelint": "", - "nodejs_package_manager_path": "npm" - } -} - - - - - 1696881387406 - - - - - - - - - From 4b0e75f779553d6dc0d961342be3eabdd0f8cb2e Mon Sep 17 00:00:00 2001 From: Meltem Kenis Date: Wed, 8 Nov 2023 21:26:39 +0000 Subject: [PATCH 06/11] create news fragment using correct command --- doc/whatsnew/3/3.1/index.rst | 4 ---- doc/whatsnew/fragments/8935.other | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 doc/whatsnew/fragments/8935.other diff --git a/doc/whatsnew/3/3.1/index.rst b/doc/whatsnew/3/3.1/index.rst index 96bf3b88f7..e706981f21 100644 --- a/doc/whatsnew/3/3.1/index.rst +++ b/doc/whatsnew/3/3.1/index.rst @@ -34,7 +34,3 @@ Other Changes - Fix a crash when an enum class which is also decorated with a ``dataclasses.dataclass`` decorator is defined. Closes #9100 (`#9100 `_) - -- Printing how many files were checked in verbose. - - Closes #8935 (`#8935 `_) diff --git a/doc/whatsnew/fragments/8935.other b/doc/whatsnew/fragments/8935.other new file mode 100644 index 0000000000..8685e4e63d --- /dev/null +++ b/doc/whatsnew/fragments/8935.other @@ -0,0 +1,3 @@ +Print how many files were checked in verbose. + +Closes 8935 From d9441c79a2eacf65f5a5e02e246990573bf4608b Mon Sep 17 00:00:00 2001 From: Meltem Kenis Date: Wed, 8 Nov 2023 21:27:45 +0000 Subject: [PATCH 07/11] remove previous changes from index.rst file --- doc/whatsnew/3/3.1/index.rst | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/doc/whatsnew/3/3.1/index.rst b/doc/whatsnew/3/3.1/index.rst index e706981f21..9d884ea419 100644 --- a/doc/whatsnew/3/3.1/index.rst +++ b/doc/whatsnew/3/3.1/index.rst @@ -12,25 +12,4 @@ Summary -- Release highlights ============================= -.. towncrier release notes start - -What's new in Pylint 3.1.0? ---------------------------- -Release date: 2023-11-08 - - -False Positives Fixed ---------------------- - -- Fixed false positive for ``inherit-non-class`` for generic Protocols. - - Closes #9106 (`#9106 `_) - - - -Other Changes -------------- - -- Fix a crash when an enum class which is also decorated with a ``dataclasses.dataclass`` decorator is defined. - - Closes #9100 (`#9100 `_) +.. towncrier release notes start \ No newline at end of file From d8838a9dde9361b25d8a3152c009ec73667b8253 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 8 Nov 2023 21:30:02 +0000 Subject: [PATCH 08/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- doc/whatsnew/3/3.1/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whatsnew/3/3.1/index.rst b/doc/whatsnew/3/3.1/index.rst index 9d884ea419..f59a07561f 100644 --- a/doc/whatsnew/3/3.1/index.rst +++ b/doc/whatsnew/3/3.1/index.rst @@ -12,4 +12,4 @@ Summary -- Release highlights ============================= -.. towncrier release notes start \ No newline at end of file +.. towncrier release notes start From 6553f5da6ee78ff0fce264d0e898ced4f8fb257b Mon Sep 17 00:00:00 2001 From: Meltem Kenis Date: Wed, 8 Nov 2023 21:32:19 +0000 Subject: [PATCH 09/11] Update index.rst --- doc/whatsnew/3/3.1/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/whatsnew/3/3.1/index.rst b/doc/whatsnew/3/3.1/index.rst index f59a07561f..37ddab5759 100644 --- a/doc/whatsnew/3/3.1/index.rst +++ b/doc/whatsnew/3/3.1/index.rst @@ -12,4 +12,5 @@ Summary -- Release highlights ============================= + .. towncrier release notes start From 7c8bdfa71ddd011944a1ae6cd8b39f0042f19ec4 Mon Sep 17 00:00:00 2001 From: Meltem Kenis Date: Wed, 8 Nov 2023 21:32:36 +0000 Subject: [PATCH 10/11] Update 8935.other --- doc/whatsnew/fragments/8935.other | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whatsnew/fragments/8935.other b/doc/whatsnew/fragments/8935.other index 8685e4e63d..9e78499aeb 100644 --- a/doc/whatsnew/fragments/8935.other +++ b/doc/whatsnew/fragments/8935.other @@ -1,3 +1,3 @@ -Print how many files were checked in verbose. +Print how many files were checked in verbose mode. Closes 8935 From 283eff9ea9fd12d01b5cfd871ed036b68aaef511 Mon Sep 17 00:00:00 2001 From: Meltem Kenis Date: Wed, 8 Nov 2023 21:37:25 +0000 Subject: [PATCH 11/11] Update 8935.other --- doc/whatsnew/fragments/8935.other | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whatsnew/fragments/8935.other b/doc/whatsnew/fragments/8935.other index 9e78499aeb..f105c8eb11 100644 --- a/doc/whatsnew/fragments/8935.other +++ b/doc/whatsnew/fragments/8935.other @@ -1,3 +1,3 @@ Print how many files were checked in verbose mode. -Closes 8935 +Closes #8935