Variables used only in a format string are marked as unused
This commit is contained in:
Oleg Shpynov
2010-03-03 13:22:05 +03:00
parent 18ca5af5fd
commit f3c9b3e9d2
@@ -53,10 +53,26 @@ class PyUnusedLocalVariableInspectionVisitor extends PyInspectionVisitor {
registerProblems();
}
class DontPerformException extends RuntimeException {}
private void processScope(final ScopeOwner owner) {
// TODO[oleg] Do not show warning in python code expression mode (evaluate in debug or watches)
// Do not perform inspection if locals() call is found
try {
owner.accept(new PyRecursiveElementVisitor(){
@Override
public void visitPyCallExpression(final PyCallExpression node) {
if ("locals".equals(node.getCallee().getText())){
throw new DontPerformException();
}
}
});
}
catch (DontPerformException e) {
return;
}
// If method overrides others do not mark parameters as unused if they are
boolean parametersCanBeUnused = false;
if (owner instanceof PyFunction) {