01: /**
02: * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
03: */package net.sourceforge.pmd.rules;
04:
05: import net.sourceforge.pmd.AbstractRule;
06: import net.sourceforge.pmd.ast.ASTMethodDeclarator;
07:
08: public class MethodNamingConventions extends AbstractRule {
09:
10: public Object visit(ASTMethodDeclarator node, Object data) {
11:
12: String methodName = node.getImage();
13:
14: if (Character.isUpperCase(methodName.charAt(0))) {
15: addViolationWithMessage(data, node,
16: "Method names should not start with capital letters");
17: }
18: if (methodName.indexOf('_') >= 0) {
19: addViolationWithMessage(data, node,
20: "Method names should not contain underscores");
21: }
22: return data;
23: }
24:
25: }
|