1 package net.sourceforge.pmd.rules;
2
3 import net.sourceforge.pmd.AbstractRule;
4 import net.sourceforge.pmd.RuleContext;
5 import net.sourceforge.pmd.ast.ASTUnmodifiedClassDeclaration;
6
7 public class ClassNamingConventionsRule extends AbstractRule {
8
9 public Object visit(ASTUnmodifiedClassDeclaration node, Object data) {
10
11 if (Character.isLowerCase(node.getImage().charAt(0))) {
12 RuleContext ctx = (RuleContext)data;
13 ctx.getReport().addRuleViolation(createRuleViolation(ctx, node.getBeginLine(), getMessage()));
14 }
15
16 if (node.getImage().indexOf("_") >= 0) {
17 RuleContext ctx = (RuleContext)data;
18 ctx.getReport().addRuleViolation(createRuleViolation(ctx, node.getBeginLine(), "Class names should not contain underscores"));
19
20 }
21
22 return data;
23 }
24 }
This page was automatically generated by Maven