mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
enable "Double negation" inspection by default
This commit is contained in:
@@ -603,7 +603,7 @@
|
||||
groupKey="group.names.control.flow.issues" enabledByDefault="false" level="WARNING"
|
||||
implementationClass="com.siyeh.ig.controlflow.DefaultNotLastCaseInSwitchInspection"/>
|
||||
<localInspection language="JAVA" shortName="DoubleNegation" bundle="com.siyeh.InspectionGadgetsBundle" key="double.negation.display.name"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.control.flow.issues" enabledByDefault="false"
|
||||
groupBundle="messages.InspectionsBundle" groupKey="group.names.control.flow.issues" enabledByDefault="true"
|
||||
level="WARNING" implementationClass="com.siyeh.ig.controlflow.DoubleNegationInspection"/>
|
||||
<localInspection language="JAVA" shortName="DuplicateBooleanBranch" bundle="com.siyeh.InspectionGadgetsBundle"
|
||||
key="duplicate.boolean.branch.display.name" groupBundle="messages.InspectionsBundle"
|
||||
|
||||
+7
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2011 Bas Leijdekkers
|
||||
* Copyright 2006-2012 Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,6 +40,11 @@ public class DoubleNegationInspection extends BaseInspection {
|
||||
return InspectionGadgetsBundle.message("double.negation.problem.descriptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledByDefault() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
return new DoubleNegationFix();
|
||||
@@ -117,7 +122,7 @@ public class DoubleNegationInspection extends BaseInspection {
|
||||
registerError(expression);
|
||||
}
|
||||
|
||||
private static boolean isNegation(PsiExpression expression) {
|
||||
private static boolean isNegation(@Nullable PsiExpression expression) {
|
||||
expression = ParenthesesUtils.stripParentheses(expression);
|
||||
if (expression instanceof PsiPrefixExpression) return isNegation((PsiPrefixExpression)expression);
|
||||
if (expression instanceof PsiPolyadicExpression) return isNegation((PsiPolyadicExpression)expression);
|
||||
|
||||
Reference in New Issue
Block a user