mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 09:55:29 +02:00
Added arguments, description and externalized strings
This commit is contained in:
parent
f4f2bfd6ee
commit
6e50087a2b
6 changed files with 12 additions and 8 deletions
|
@ -13,7 +13,7 @@
|
|||
defaultSeverity="Warning"
|
||||
description="Finds statements like 'if (a=b)'"
|
||||
id="org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem"
|
||||
messagePattern="Possible assignment in condition"
|
||||
messagePattern="Possible assignment in condition ''{0}''"
|
||||
name="Assignment in condition">
|
||||
</problem>
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
|||
<problem
|
||||
category="org.eclipse.cdt.codan.core.categories.ProgrammingProblems"
|
||||
defaultSeverity="Warning"
|
||||
description="If destructor is not declared virtual - destructor of derived class would not be called."
|
||||
id="org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem"
|
||||
messagePattern="Class ''{0}'' has virtual method ''{1}'' but non-virtual destructor ''{2}''"
|
||||
name="Class has a virtual method and non-virtual destructor">
|
||||
|
@ -55,7 +56,7 @@
|
|||
description="Catching by reference is recommended by C++ experts, "Throw by value, catch by reference". For one thing, this avoids copying and potentially slicing the exception."
|
||||
id="org.eclipse.cdt.codan.internal.checkers.CatchByReference"
|
||||
name="Catching by reference is recommended"
|
||||
messagePattern="Catching by reference is recommended for non-basic types">
|
||||
messagePattern="Catching by reference is recommended ''{0}''">
|
||||
</problem>
|
||||
</checker>
|
||||
<checker
|
||||
|
@ -65,8 +66,9 @@
|
|||
<problem
|
||||
category="org.eclipse.cdt.codan.core.categories.ProgrammingProblems"
|
||||
defaultSeverity="Warning"
|
||||
description="This checker finds problems related to either lack of understanding precedence of operators or misspelling of operators in expression. For example (!a<10) or (a && b & c)"
|
||||
id="org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem"
|
||||
messagePattern="Suggested parenthesis around expression"
|
||||
messagePattern="Suggested parenthesis around expression ''{0}''"
|
||||
name="Suggested parenthesis around expression">
|
||||
</problem>
|
||||
</checker>
|
||||
|
|
|
@ -35,7 +35,7 @@ public class AssignmentInConditionChecker extends AbstractIndexAstChecker {
|
|||
public int visit(IASTExpression expression) {
|
||||
if (isAssignmentExpression(expression)
|
||||
&& isUsedAsCondition(expression)) {
|
||||
reportProblem(ER_ID, expression);
|
||||
reportProblem(ER_ID, expression, expression.getRawSignature());
|
||||
}
|
||||
return PROCESS_CONTINUE;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class CatchByReference extends AbstractIndexAstChecker {
|
|||
|| typeName instanceof IPointerType
|
||||
|| typeName == null)
|
||||
continue;
|
||||
reportProblem(ER_ID, decl);
|
||||
reportProblem(ER_ID, decl, decl.getRawSignature());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ public class CheckersMessages extends NLS {
|
|||
public static String StatementHasNoEffectChecker_ParameterExceptions;
|
||||
public static String StatementHasNoEffectChecker_ParameterExceptionsItem;
|
||||
public static String StatementHasNoEffectChecker_ParameterMacro;
|
||||
public static String SuggestedParenthesisChecker_SuggestParanthesesAroundNot;
|
||||
static {
|
||||
// initialize resource bundle
|
||||
NLS.initializeMessages(BUNDLE_NAME, CheckersMessages.class);
|
||||
|
|
|
@ -56,14 +56,14 @@ public class SuggestedParenthesisChecker extends AbstractIndexAstChecker {
|
|||
return PROCESS_CONTINUE;
|
||||
if (precedence == 2) { // unary not
|
||||
if (isParamNot() && isUsedAsOperand(expression)) {
|
||||
reportProblem(ER_ID, expression);
|
||||
reportProblem(ER_ID, expression, expression.getRawSignature());
|
||||
return PROCESS_SKIP;
|
||||
}
|
||||
} else if (precedence >= 0) {
|
||||
int pp = getPrecedence(parentExpr);
|
||||
if (pp == -1 || pp == precedence)
|
||||
return PROCESS_CONTINUE;
|
||||
reportProblem(ER_ID, expression);
|
||||
reportProblem(ER_ID, expression, expression.getRawSignature());
|
||||
}
|
||||
}
|
||||
return PROCESS_CONTINUE;
|
||||
|
@ -136,6 +136,6 @@ public class SuggestedParenthesisChecker extends AbstractIndexAstChecker {
|
|||
public void initPreferences(IProblemWorkingCopy problem) {
|
||||
super.initPreferences(problem);
|
||||
addPreference(problem, PARAM_NOT,
|
||||
"Suggest parentesis around not operator", Boolean.FALSE);
|
||||
CheckersMessages.SuggestedParenthesisChecker_SuggestParanthesesAroundNot, Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,3 +3,4 @@ ReturnChecker_Param0=Also check functions with implicit return value
|
|||
StatementHasNoEffectChecker_ParameterExceptions=Exceptions (value of the problem argument)
|
||||
StatementHasNoEffectChecker_ParameterExceptionsItem=Value of the argument
|
||||
StatementHasNoEffectChecker_ParameterMacro=Report problem in statements that comes from macro expansion
|
||||
SuggestedParenthesisChecker_SuggestParanthesesAroundNot=Suggest parentesis around not operator
|
||||
|
|
Loading…
Add table
Reference in a new issue