How do I disable a bogus pylint warning for a multiline string just for that string?
The first disable works, the second (bogus warning) does not.
Edited after initial answer for a simpler example.
#!/usr/bin/env python
print 0!= 1 # pylint: disable=C0322
print {''
# pylint: disable=C0322
: '''%
'''
# pylint: enable=C0322
}
I get
************* Module foobar
C0322: 4: Operator not preceded by a space
print {''
: '''%
^
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.
you can ignore it by adding a comment in the format # pylint: disable=[problem-code] at the end of the line where [problem-code] is the value inside pylint(...) in the pylint message – for example, abstract-class-instantiated for the problem report listed above.
How do I get rid of invalid name pylint? Create an empty Python file called run-tests.py. At the top of the file, add # pylint: disable=invalid-name so that pylint won't complain about the module name.
Pylint analyses your code without actually running it. 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).
you can do something like
# pylint: disable=C0322
print 0!= 1
print '''%
'''
# pylint: enable=C0322
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