add both add field and remove param QuickFixes for the param in __init__ method

This commit is contained in:
Ekaterina Tuzova
2014-05-08 14:11:37 +04:00
parent 2d20acbcd9
commit e7f0c335b0
@@ -300,17 +300,14 @@ public class PyUnusedLocalInspectionVisitor extends PyInspectionVisitor {
boolean canRemove = !(PsiTreeUtil.getPrevSiblingOfType(element, PyParameter.class) instanceof PySingleStarParameter) ||
PsiTreeUtil.getNextSiblingOfType(element, PyParameter.class) != null;
final LocalQuickFix[] fixes;
final List<LocalQuickFix> fixes = new ArrayList<LocalQuickFix>();
if (mayBeField) {
fixes = new LocalQuickFix[]{new AddFieldQuickFix(name, name, containingClass.getName())};
fixes.add(new AddFieldQuickFix(name, name, containingClass.getName()));
}
else if (canRemove) {
fixes = new LocalQuickFix[]{new PyRemoveParameterQuickFix()};
if (canRemove) {
fixes.add(new PyRemoveParameterQuickFix());
}
else {
fixes = LocalQuickFix.EMPTY_ARRAY;
}
registerWarning(element, PyBundle.message("INSP.unused.locals.parameter.isnot.used", name), fixes);
registerWarning(element, PyBundle.message("INSP.unused.locals.parameter.isnot.used", name), fixes.toArray(new LocalQuickFix[fixes.size()]));
}
else {
if (myIgnoreTupleUnpacking && isTupleUnpacking(element)) {