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

Add error for in-place operations on result

Open jamescooke opened this issue 4 years ago • 0 comments

Example:

def test_addition():
    result = 1 + 1

    assert result == 2
    result += 1
    assert result == 3
    result /= 3
    assert result == 1

Expected error:

AAA0x: Additional operations on result (2)

Resolution doc will advise: Squash into Act or extract to separate test(s).

See also: https://docs.python.org/3.8/library/operator.html#in-place-operators

jamescooke avatar May 02 '20 12:05 jamescooke