added missing violation description

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4615 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Brian Remedios
2006-10-10 05:09:06 +00:00
parent 95857a8b62
commit 67471afb6d

View File

@ -9,10 +9,13 @@ import net.sourceforge.pmd.ast.ASTMethodDeclarator;
public class MethodNamingConventions extends AbstractRule {
public Object visit(ASTMethodDeclarator node, Object data) {
if (Character.isUpperCase(node.getImage().charAt(0))) {
addViolation(data, node);
String methodName = node.getImage();
if (Character.isUpperCase(methodName.charAt(0))) {
addViolationWithMessage(data, node, "Method names should not start with capital letters");
}
if (node.getImage().indexOf('_') >= 0) {
if (methodName.indexOf('_') >= 0) {
addViolationWithMessage(data, node, "Method names should not contain underscores");
}
return data;