Clover coverage report - PMD - 3.9 Coverage timestamp: Tue Dec 19 2006 09:38:44 EST FRAMES NO FRAMES |
file stats: | LOC: | 24 |  | Methods: | 1
| NCLOC: | 15 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
MethodNamingConventions.java | 100% | 100% | 100% | 100% |

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