flake8-aaa icon indicating copy to clipboard operation
flake8-aaa copied to clipboard

AAA05 Blank line in block is not raised when additional blank line is followed by a hash comment

Open jamescooke opened this issue 11 months ago • 0 comments

Current behaviour

When running Flake8-AAA on a test file that has additional blank lines in blocks, error AAA05 is not raised when those additional lines are followed by a hash-comment line.

For example:

# Line 1
def test_arrange_with_comment() -> None:
    x = 3

    # Y is a very important value
    y = 4

    result = x**2 + y**2

    assert result == 25

AAA05 is not raised on line 4, and the test passes linting.

The same happens for Assert blocks:

# Line 1
def test_assert_with_comment() -> None:
    x = 3
    y = 4

    result = x**2 + y**2

    assert result == 25

    # Check it again, Sam
    assert result == 25

The test passes lint unexpectedly.

Expected behaviour

It doesn't matter that the extra blank line is followed by a comment - AAA05 is raised.

  • In the first example, AAA05 is raised on line 4.
  • In the second example, AAA05 is raised on line 9.

Debugging info

Output of python --version:

Python 3.12.0

Output of flake8 --version:

7.0.0 (flake8-aaa: 0.17.0, mccabe: 0.7.0, pycodestyle: 2.11.1, pyflakes: 3.2.0) CPython 3.12.0 on Linux

jamescooke avatar Feb 24 '24 23:02 jamescooke