From d064010c324cb20a83928c5bae02386ea73fe8d7 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Wed, 22 Feb 2023 23:31:06 +0100 Subject: [PATCH] [doc] Add an example for suppressed-message (#8328) I initially wanted to activate invalid-name so we follow pep8 in our examples but there's more than 50 violations right now. I much prefer to keep all of these weird issues contained to one documentation example rather than affecting all other tests for it. Co-authored-by: Daniel van Noord <13665637+DanielNoord@users.noreply.github.com> --- doc/data/messages/s/suppressed-message/bad.py | 9 +++++++++ doc/data/messages/s/suppressed-message/details.rst | 5 ++++- doc/data/messages/s/suppressed-message/good.py | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 doc/data/messages/s/suppressed-message/bad.py diff --git a/doc/data/messages/s/suppressed-message/bad.py b/doc/data/messages/s/suppressed-message/bad.py new file mode 100644 index 0000000000..5b4c437acf --- /dev/null +++ b/doc/data/messages/s/suppressed-message/bad.py @@ -0,0 +1,9 @@ +### This is a contrived example, to show how suppressed-message works. +### First we enable all messages +# pylint: enable=all + +### Here we disable two messages so we get two warnings +# pylint: disable=locally-disabled, useless-suppression # [suppressed-message, suppressed-message] + +### Here we disable a message, so we get a warning for suppressed-message again. +"A" # pylint: disable=pointless-statement # [suppressed-message, suppressed-message] diff --git a/doc/data/messages/s/suppressed-message/details.rst b/doc/data/messages/s/suppressed-message/details.rst index ab82045295..ceb0ba72cf 100644 --- a/doc/data/messages/s/suppressed-message/details.rst +++ b/doc/data/messages/s/suppressed-message/details.rst @@ -1 +1,4 @@ -You can help us make the doc better `by contributing `_ ! +``suppressed-message`` is simply a way to see messages that would be raised +without the disable in your codebase. It should not be activated most +of the time. See also ``useless-suppression`` if you want to see the message +that are disabled for no reasons. diff --git a/doc/data/messages/s/suppressed-message/good.py b/doc/data/messages/s/suppressed-message/good.py index c40beb573f..39c3624803 100644 --- a/doc/data/messages/s/suppressed-message/good.py +++ b/doc/data/messages/s/suppressed-message/good.py @@ -1 +1 @@ -# This is a placeholder for correct code for this message. +"""Instead of a single string somewhere in the file, write a module docstring!"""