ptvsd uses # noqa to disable linting for specific lines, for example:
try:
unicode # noqa
def needs_unicode(value):
return isinstance(value, unicode) # noqa
except Exception:
def needs_unicode(value):
return False
Any diagnostics we output should respect comments like these. I believe there are other ones out there depending on the linter, like #pylint: disable and # NOQA.
Linting could be also disabled for a particular warning.
For example, pylint has the following way of locally disabling a warning:
4.1 Is it possible to locally disable a particular message?
Yes, this feature has been added in Pylint 0.11.
This may be done by adding “#pylint: disable=some-message,another-one”
at the desired block level or at the end of the desired line of code.
This feature would be great to have!
For the record, # noqa also supports disabling specific warnings with # noqa: E731. python-language-server could support that as well.
Partial support for this will come in #1272 (catch-all noqa), but we'll need mappings from other tools' codes in order to go further.
https://github.com/microsoft/python-language-server/pull/1272 adds basic support. New issue will be opened for more advanced cases.
Most helpful comment
Linting could be also disabled for a particular warning.
For example,
pylinthas the following way of locally disabling a warning: