mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Don't warn about unused augmented assignments since they may have side effects (PY-14429)
This commit is contained in:
@@ -125,6 +125,9 @@ public class PyUnusedLocalInspectionVisitor extends PyInspectionVisitor {
|
||||
if (PyImportStatementNavigator.getImportStatementByElement(element) != null) {
|
||||
continue;
|
||||
}
|
||||
if (PyAugAssignmentStatementNavigator.getStatementByTarget(element) != null) {
|
||||
continue;
|
||||
}
|
||||
if (!myUsedElements.contains(element)) {
|
||||
myUnusedElements.add(element);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ def foo1():
|
||||
<weak_warning descr="Local variable 'aaa' value is not used">aaa</weak_warning> = 2 #fail
|
||||
|
||||
bbb = 1 #pass
|
||||
<weak_warning descr="Local variable 'bbb' value is not used">bbb</weak_warning> += 2 #fail
|
||||
return bbb
|
||||
|
||||
def bar(<weak_warning descr="Parameter 'self' value is not used">self</weak_warning>): #fail
|
||||
print("Foo")
|
||||
@@ -291,7 +291,7 @@ def test_unused_empty_function(<weak_warning descr="Parameter 'x' value is not u
|
||||
# PY-7072
|
||||
def test_unused_variable_in_cycle(x, c):
|
||||
while x > 0:
|
||||
x -= 1 #pass
|
||||
x = x - 1 #pass
|
||||
if c:
|
||||
break
|
||||
|
||||
@@ -316,3 +316,7 @@ def test_unused_empty_init_parameter():
|
||||
|
||||
return C
|
||||
|
||||
|
||||
# PY-14429
|
||||
def test_used_local_augmented_assignment(x, y):
|
||||
x += y
|
||||
|
||||
Reference in New Issue
Block a user