You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug description:
CFQ001 takes into account empty lines and comment lines when counting number of lines inside a function.
To Reproduce:
Steps to reproduce the behavior:
Create a function that contains some empty lines and/or comments lines
Run flake8 with the --max-function-length=N where N is the number of line of your function (without counting the empty line and comment line)
Expected behavior:
CFQ001 should only count lines of actual code. Taking into account empty lines and comment lines may lead to developers removing some comments or empty lines to fix CFQ001 linting error. Thus, making the code less readable.
Desktop:
OS:Manjaro Linux x86_64
Python : 3.9.7
Flake8: 4.0.1
Flake8-functions : 0.0.6
The text was updated successfully, but these errors were encountered:
Agreed and seconding this as a concern. I'm finding exactly what was described in the initial report: developers started removing comments -- and necessary and helpful comments -- from functions just to satisfy this lint check.
Length from a linting perspective should only be taking into account executable lines of code. That said, I could see a desire by some to also check for all lines, including non-executable ones. In that case, maybe there should be a configuration option? Something like count-only-executable-lines or include-non-executable-lines or whatever makes sense.
The closing brace/bracket/parenthesis on multiline constructs may either line up under the first non-whitespace character of the last line of list [...] or it may be lined up under the first character of the line that starts the multiline construct:
How should we consider lines with just a closing brace/bracket/parenthesis ? For example, should we count 3 or 4 lines for the following code :
Bug description:
CFQ001 takes into account empty lines and comment lines when counting number of lines inside a function.
To Reproduce:
Steps to reproduce the behavior:
--max-function-length=N
where N is the number of line of your function (without counting the empty line and comment line)Expected behavior:
CFQ001 should only count lines of actual code. Taking into account empty lines and comment lines may lead to developers removing some comments or empty lines to fix CFQ001 linting error. Thus, making the code less readable.
Desktop:
The text was updated successfully, but these errors were encountered: