#PY-16228 fixed Enable PyArgumentEqualDefaultInspection for decorators

This commit is contained in:
Valentina Kiryushkina
2015-12-24 11:44:20 +03:00
parent 3a23a6ea33
commit 7c95af9b52
2 changed files with 20 additions and 1 deletions
@@ -80,6 +80,18 @@ public class PyArgumentEqualDefaultInspection extends PyInspection {
checkArguments(node, node.getArguments());
}
@Override
public void visitPyDecoratorList(final PyDecoratorList node) {
PyDecorator[] decorators = node.getDecorators();
for (PyDecorator decorator: decorators) {
if (decorator.hasArgumentList()) {
PyExpression[] arguments = decorator.getArguments();
checkArguments(decorator, arguments);
}
}
}
private static boolean hasSpecialCasedDefaults(PyCallable callable, PsiElement anchor) {
final String name = callable.getName();
final PyBuiltinCache cache = PyBuiltinCache.getInstance(anchor);
@@ -78,4 +78,11 @@ def f1(value=-1):
print(value)
def f2():
f1(value =-2)
f1(value =-2)
def decorator(arg='baz'):
return lambda x: x
@decorator(<weak_warning descr="Argument equals to default parameter value">arg='baz'</weak_warning>)
def f<error descr="'(' expected">:</error>
pass