mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-618
Variables used only in a format string are marked as unused
This commit is contained in:
+16
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user