Is it possible to disable certain pylint errors/warnings in the python source code itself ?
Enable linting# To enable linters, open the Command Palette (Ctrl+Shift+P) and select the Python: Select Linter command. The Select Linter command adds "python. linting. <linter>Enabled": true to your settings, where <linter> is the name of the chosen linter.
It checks for errors, enforces a coding standard, looks for code smells, and can make suggestions about how the code could be refactored. Pylint can infer actual values from your code using its internal code representation (astroid). If your code is import logging as argparse , Pylint will know that argparse.
def foo():
print "000000000000000000000000000000000000000000000000000000000000000000000000000"
print "111111111111111111111111111111111111111111111111111111111111111111111111111"
pylint output:
C: 2: Line too long (87/80)
C: 3: Line too long (83/80)
C: 1: Missing docstring
C: 1:foo: Black listed name "foo"
C: 1:foo: Missing docstring
Add comment "# pylint: disable=CODE", code for "Line too long" message - C0301:
def foo():
# pylint: disable=C0301
print "000000000000000000000000000000000000000000000000000000000000000000000000000"
print "111111111111111111111111111111111111111111111111111111111111111111111111111"
pylint output:
I: 2: Locally disabling C0301
C: 4: Line too long (83/80)
C: 1: Missing docstring
C: 1:foo: Black listed name "foo"
C: 1:foo: Missing docstring
The #pylint: disable syntax mentionned by @kalgasnik is the correct one. You can find more information about this in the Pylint FAQ (your question is meth2
)
In the eclipse ide, with pydev, you can put a comment after the line of code, with the format # IGNORE:_ID_
. I don't know if this also works in other programs.
For example:
import something # IGNORE:W0611
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With