Show a real offset with AAA03 and AAA04 errors
jamescooke opened this issue · 2 comments
jamescooke commented
Errors regarding missing blank lines point at the 0th offset of the line above. This looks strange because those lines are always indented.
$ python -m flake8_aaa examples/bad/test_aaa03.py
------+------------------------------------------------------------------------
1 DEF|def test():
2 ARR| x = 1
^ AAA03 expected 1 blank line before Act block, found none
3 ACT| result = x**2
4 BL |
5 ASS| assert result == 4
------+------------------------------------------------------------------------
1 | ERROR
Instead of pointing at the start of line 2, this example should point at the x
:
2 ARR| x = 1
^ AAA03 expected 1 blank line before Act block, found none
jamescooke commented
AAA03 errors should be moved down a line to the ACT block. This is where they used to point:
------+------------------------------------------------------------------------
1 DEF|def test():
2 ARR| x = 1
3 ARR| y = 1
+ ^ AAA03 expected 1 blank line before Act block, found none
4 ACT| result = x + y
- ^ AAA03 expected 1 blank line before Act block, found none
5 BL |
6 ASS| assert result == 2
------+------------------------------------------------------------------------
1 | ERROR
This makes the command line output easier to read and takes the editor to the first line of the ACT block when jumping to the line of the error.
jamescooke commented
Also add examples where # noqa
is added to the appropriate lines to prevent the linting check - the location of the # noqa
should make sense in the context of the test.