Flake8 censors itself, covering errors
hwalinga opened this issue · 3 comments
hwalinga commented
how did you install flake8?
$ python -m pip install flake8
unmodified output of flake8 --bug-report
{
"platform": {
"python_implementation": "CPython",
"python_version": "3.11.2",
"system": "Linux"
},
"plugins": [
{
"plugin": "mccabe",
"version": "0.7.0"
},
{
"plugin": "pycodestyle",
"version": "2.11.1"
},
{
"plugin": "pyflakes",
"version": "3.2.0"
}
],
"version": "7.0.0"
}
describe the problem
what I expected to happen
I expected flake8 to detect errors in f-strings, but it is censoring itself by placing xxxx on them.
sample code
"""
docstring
"""
def func(a, b):
return a + b
A = f"{func(3 , 2)}"
commands ran
$ flake8 -vv t.py
It missed the whitespace before the comma.
Here is the debug output:
flake8.checker MainProcess 132 DEBUG Logical line: """"xxxxxxxxxxx""""
flake8.checker MainProcess 132 DEBUG Logical line: "def func(a, b):"
flake8.checker MainProcess 132 DEBUG Logical line: "return a + b"
flake8.checker MainProcess 133 DEBUG Logical line: "A = f"xxxxxxxxxxxxx""
flake8.main.application MainProcess 133 INFO Finished running
flake8.main.application MainProcess 133 INFO Reporting errors
flake8.main.application MainProcess 133 INFO Found a total of 0 violations and reported 0
I don't know if this is some kind of security feature, as it also censors the docstring. However, I could not find anything about this feature. Unfortunately, it works incorrectly for f-strings.
asottile commented
use 3.12+ in older versions python does not tokenize fstring internals
hwalinga commented
@asottile Can we disable this censoring behavior as a workaround for older versions of Python?
asottile commented
it would not help like you think it would