1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

- changed enablement, severity and message for naming convention checker

This commit is contained in:
Alena Laskavaia 2010-03-08 21:06:18 +00:00
parent 7aff38334e
commit 9c13ed2b01
2 changed files with 9 additions and 5 deletions

View file

@ -69,8 +69,10 @@
name="NamingConventionFunctionChecker">
<problem
category="org.eclipse.cdt.codan.core.categories.CodeStyle"
defaultSeverity="Warning"
defaultEnabled="false"
defaultSeverity="Info"
id="org.eclipse.cdt.codan.examples.checkers.NamingConventionFunctionProblem"
messagePattern="Bad function name &quot;{0}&quot; (pattern /{1}/)"
name="Name convention for function">
</problem>
</checker>

View file

@ -27,6 +27,7 @@ import org.eclipse.core.runtime.CoreException;
*/
public class NamingConventionFunctionChecker extends AbstractCIndexChecker
implements ICheckerWithParameters {
private static final String DEFAULT_PATTERN = "^[a-z]"; // name starts with english lowercase letter //$NON-NLS-1$
public static final String PARAM_KEY = "pattern"; //$NON-NLS-1$
private static final String ER_ID = "org.eclipse.cdt.codan.examples.checkers.NamingConventionFunctionProblem"; //$NON-NLS-1$
@ -49,7 +50,7 @@ public class NamingConventionFunctionChecker extends AbstractCIndexChecker
if (!pattern.matcher(name).find()) {
reportProblem(ER_ID, getFile(), 1, // TODO: line number
"Bad function name: " + name);
name, parameter);
}
return false;
}
@ -75,7 +76,7 @@ public class NamingConventionFunctionChecker extends AbstractCIndexChecker
}
public String getType() {
return "string";
return IProblemParameterInfo.TYPE_STRING;
}
public String getLabel() {
@ -91,7 +92,8 @@ public class NamingConventionFunctionChecker extends AbstractCIndexChecker
}
};
problem.setParameterInfo(info);
problem.setParameter(PARAM_KEY, "^[a-z]"); // name starts with english
// lower case letter
problem.setParameter(PARAM_KEY, DEFAULT_PATTERN);
}
}