two possible bugs of pylint examining comments when it should not #10197
Closed as not planned
Description
Bug description
#!/usr/bin/python3 -B
import sys
def main():
"""
this comment shows that pylint is flagging a \ in a comment field (code is E0012)
"""
# this comment shows that pylint is flagging a "pylint: disable=" error in
# a comment field (code is E0012)
#
sys.stdout.write ('hello\n')
if __name__ == '__main__':
main()
Configuration
Command used
pylint-3 of a file containing the code above
Pylint output
[paul@grotto ~]$ pylint pylintBooBoo.py
running pylint-3
************* Module pylintBooBoo
pylintBooBoo.py:10:0: E0012: Bad option value 'error' (bad-option-value)
pylintBooBoo.py:10:0: E0012: Bad option value 'in' (bad-option-value)
pylintBooBoo.py:7:46: W1401: Anomalous backslash in string: '\ '. String constant might be missing an r prefix. (anomalous-backslash-in-string)
-------------------------------------
Your code has been rated at -12.00/10
[paul@grotto ~]$
Expected behavior
No pylint-3 errors or warnings since problems are in commented out documentation.
As I am not running latest version of python or pylint-3 as I am on whatever Rocky9 has, these may no longer be relevant. I figured it was best to submit "just in case"
Pylint version
[paul@grotto ~]$ pylint-3 --version
pylint 2.13.7
astroid 2.11.6
Python 3.9.21 (main, Dec 5 2024, 00:00:00)
[GCC 11.5.0 20240719 (Red Hat 11.5.0-2)]
[paul@grotto ~]$
OS / Environment
Rocky Linux release 9.5 (Blue Onyx) -- fully updated