Skip to main content
summaryrefslogtreecommitdiffstats
path: root/codan
diff options
context:
space:
mode:
authorAlena Laskavaia2010-05-24 11:07:53 -0400
committerAlena Laskavaia2010-05-24 11:07:53 -0400
commit5a6ecb2fb8b2f1a170f3c9ae6b6d6420d5de9213 (patch)
treee7f38a67ae69af48598e9d5c085d9b0546dee96b /codan
parentc2919ed4f940f0e23aa90739bc9b7de13063ab24 (diff)
downloadorg.eclipse.cdt-5a6ecb2fb8b2f1a170f3c9ae6b6d6420d5de9213.tar.gz
org.eclipse.cdt-5a6ecb2fb8b2f1a170f3c9ae6b6d6420d5de9213.tar.xz
org.eclipse.cdt-5a6ecb2fb8b2f1a170f3c9ae6b6d6420d5de9213.zip
Bug 313622 Make checking for !a && b optional and off by default
Diffstat (limited to 'codan')
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/SuggestedParenthesisChecker.java28
1 files changed, 19 insertions, 9 deletions
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/SuggestedParenthesisChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/SuggestedParenthesisChecker.java
index 81131ee220..72f1892dfb 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/SuggestedParenthesisChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/SuggestedParenthesisChecker.java
@@ -21,7 +21,8 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
/**
- * This checker finds a problems which are caused by lack of understanding operator
+ * This checker finds a problems which are caused by lack of understanding
+ * operator
* precedence in C. In any case it is better to surround expressions in
* parenthesis to improve readability. Example: ! x>0 && x<10 (this would be
* (!x)>0 && x<10 in C) We only look for &&, || and ! operators (and binary | &
@@ -31,8 +32,10 @@ import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
*
*/
public class SuggestedParenthesisChecker extends AbstractIndexAstChecker {
- private static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem"; //$NON-NLS-1$
- private static final String PARAM_NOT = "paramNot";
+ public static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem"; //$NON-NLS-1$
+ public static final String PARAM_NOT = "paramNot"; //$NON-NLS-1$
+
+
public void processAst(IASTTranslationUnit ast) {
// traverse the ast using the visitor pattern.
@@ -116,16 +119,23 @@ public class SuggestedParenthesisChecker extends AbstractIndexAstChecker {
}
return false;
}
- public boolean isParamNot(){
- return (Boolean) getPreference(getProblemById(ER_ID, getFile()), PARAM_NOT);
+
+ public boolean isParamNot() {
+ return (Boolean) getPreference(getProblemById(ER_ID, getFile()),
+ PARAM_NOT);
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.codan.core.model.AbstractCheckerWithProblemPreferences#initPreferences(org.eclipse.cdt.codan.core.model.IProblemWorkingCopy)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.core.model.AbstractCheckerWithProblemPreferences
+ * #initPreferences(org.eclipse.cdt.codan.core.model.IProblemWorkingCopy)
*/
@Override
public void initPreferences(IProblemWorkingCopy problem) {
super.initPreferences(problem);
- addPreference(problem, PARAM_NOT, "Suggest parentesis around not operator", Boolean.FALSE);
-
+ addPreference(problem, PARAM_NOT,
+ "Suggest parentesis around not operator", Boolean.FALSE);
}
}

Back to the top