diff options
author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2021-08-05 06:59:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-05 06:59:00 +0200 |
commit | 7d84a322afb129045b5c82790bad56b7d7f4fbc3 (patch) | |
tree | ea159d966f239f763bdae15bdafa16ad15fcdd0f /doc/faq.rst | |
parent | 8ea16d4077412f1ce7c4ebee551ff8fc0947f35a (diff) | |
download | pylint-git-7d84a322afb129045b5c82790bad56b7d7f4fbc3.tar.gz |
Add ``disable-next`` option (#4797)
* Add ``disable-next`` option
Adding `# pylint: disable-next=msgid` to your file will disable the
message for the next line.
This closes #1682
* Add documentation, rorganize the FAQ for disable/enable and add ref to the full doc
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Diffstat (limited to 'doc/faq.rst')
-rw-r--r-- | doc/faq.rst | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/doc/faq.rst b/doc/faq.rst index d679bc286..02e252457 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -123,12 +123,20 @@ Much probably. Read :ref:`ide-integration` 4.1 How to disable a particular message? ----------------------------------------------------------- -Add "#pylint: disable=some-message,another-one" at the desired block level -or at the end of the desired line of code. - -A block is either a scope (say a function, a module), or a multiline statement (Try, Finally, if statements, for loops). +For a single line : Add ``#pylint: disable=some-message,another-one`` at the +end of the desired line of code. Since Pylint 2.10 you can also use +``#pylint: disable-next=...`` on the line just above the problem. +``...`` in the following example is a short hand for the list of +messages you want to disable. + +For larger disable : You can add ``#pylint: disable=...`` at the block level to +disable for the block. It's possible to enable for the reminder of the block +with ``#pylint: enable=...`` A block is either a scope (say a function, a module), +or a multiline statement (try, finally, if statements, for loops). `It's currently impossible to disable inside an else block`_ +Read :ref:`message-control` for details and examples. + .. _`It's currently impossible to disable inside an else block`: https://github.com/PyCQA/pylint/issues/872 4.2 Is there a way to disable a message for a particular module only? |