I would like to disable a warning in pylint
and also say why I'm disabling it:
from typing import Union, NoReturn, Optional # pylint: disable=unused-import (unused because hack for forward declaration!)
But this gives me the error:
bad-option-value: Bad option value 'declaration'
Is there a way to comment/provide context on why a warning is disabled? Or does it have to be on another line in order to do that?
The source code for parsing these "pragma" comments is here:
https://github.com/PyCQA/pylint/blob/master/pylint/utils/pragma_parser.py
It says:
Allow stopping after the first semicolon/hash encountered, so that an option can be continued with the reasons why it is active or disabled.
So yes, it is possible.
If I understand this code correctly, you should be able to use
# pylint: disable=unused-import # unused because hack for forward declaration!
or
# pylint: disable=unused-import ; unused because hack for forward declaration!