From 59efb440a78543d52909f2c6591ad2ebe27e8769 Mon Sep 17 00:00:00 2001 From: Stavros Ntentos <133706+stdedos@users.noreply.github.com> Date: Wed, 22 Feb 2023 09:45:59 +0200 Subject: [PATCH 1/2] Documentation: Order of messages In https://github.com/PyCQA/pylint/pull/7162, "we decreed" that the `bad_code` goes first, then the `good_code`. Fixup current changes, to revert "back to standards". Additionally, tackle the comment here https://github.com/PyCQA/pylint/pull/8287#issuecomment-1437983737 "Message emitted" is technically still code (`%-formatting`); let us make it stand out properly. Signed-off-by: Stavros Ntentos <133706+stdedos@users.noreply.github.com> --- doc/exts/pylint_messages.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/exts/pylint_messages.py b/doc/exts/pylint_messages.py index 49021d3f4f..b16f7b0264 100644 --- a/doc/exts/pylint_messages.py +++ b/doc/exts/pylint_messages.py @@ -84,7 +84,7 @@ def _get_example_code(data_path: Path) -> str: ) _check_placeholders(data_path, bad_code, details, related) - return "\n".join((good_code, bad_code, pylintrc, details, related)) + "\n" + return "\n".join((bad_code, good_code, pylintrc, details, related)) + "\n" def _get_pylintrc_code(data_path: Path) -> str: @@ -307,7 +307,7 @@ def _generate_single_message_body(message: MessageData) -> str: {get_rst_title(f"{message.name} / {message.id}", "=")} **Message emitted:** -{message.definition.msg} +``{message.definition.msg}`` **Description:** From dd8d3da111a32a622178f3d83e64740e3aac1b62 Mon Sep 17 00:00:00 2001 From: Stavros Ntentos <133706+stdedos@users.noreply.github.com> Date: Wed, 22 Feb 2023 13:44:25 +0200 Subject: [PATCH 2/2] "Message emitted" improvements caused issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wrapping "Message emitted" in monospaced formatting, causes `W1507` (`pylint/checkers/stdlib.py`) to fail on a stray space. Fix that - as it seems to be the only outlier. (Might've been nice for a more formal check in the first place 🙏). Signed-off-by: Stavros Ntentos <133706+stdedos@users.noreply.github.com> --- pylint/checkers/stdlib.py | 2 +- tests/functional/s/shallow_copy_environ.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pylint/checkers/stdlib.py b/pylint/checkers/stdlib.py index c9bec38232..e46b5f5744 100644 --- a/pylint/checkers/stdlib.py +++ b/pylint/checkers/stdlib.py @@ -386,7 +386,7 @@ class StdlibChecker(DeprecatedMixin, BaseChecker): "By default, the first parameter is the group param, not the target param.", ), "W1507": ( - "Using copy.copy(os.environ). Use os.environ.copy() instead. ", + "Using copy.copy(os.environ). Use os.environ.copy() instead.", "shallow-copy-environ", "os.environ is not a dict object but proxy object, so " "shallow copy has still effects on original object. " diff --git a/tests/functional/s/shallow_copy_environ.txt b/tests/functional/s/shallow_copy_environ.txt index 73c2c9d27e..b7e37e2621 100644 --- a/tests/functional/s/shallow_copy_environ.txt +++ b/tests/functional/s/shallow_copy_environ.txt @@ -1,2 +1,2 @@ -shallow-copy-environ:7:0:7:21::Using copy.copy(os.environ). Use os.environ.copy() instead. :UNDEFINED -shallow-copy-environ:17:0:17:18::Using copy.copy(os.environ). Use os.environ.copy() instead. :UNDEFINED +shallow-copy-environ:7:0:7:21::Using copy.copy(os.environ). Use os.environ.copy() instead.:UNDEFINED +shallow-copy-environ:17:0:17:18::Using copy.copy(os.environ). Use os.environ.copy() instead.:UNDEFINED