Clover coverage report - PMD - 3.3
Coverage timestamp: Thu Sep 15 2005 17:59:57 EDT
file stats: LOC: 38   Methods: 1
NCLOC: 30   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
UnusedFormalParameterRule.java 80% 100% 100% 91.3%
coverage coverage
 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.ASTClassOrInterfaceDeclaration;
 8    import net.sourceforge.pmd.ast.ASTMethodDeclaration;
 9    import net.sourceforge.pmd.ast.Node;
 10    import net.sourceforge.pmd.symboltable.VariableNameDeclaration;
 11   
 12    import java.util.Iterator;
 13    import java.util.List;
 14    import java.util.Map;
 15   
 16    public class UnusedFormalParameterRule extends AbstractRule {
 17   
 18  9 public Object visit(ASTMethodDeclaration node, Object data) {
 19  9 if (!node.isPrivate() && !hasProperty("checkall")) {
 20  5 return data;
 21    }
 22   
 23  4 if (!node.isNative()) {
 24  4 Node parent = node.jjtGetParent().jjtGetParent().jjtGetParent();
 25  4 if (parent instanceof ASTClassOrInterfaceDeclaration && !((ASTClassOrInterfaceDeclaration)parent).isInterface()) {
 26  4 Map vars = node.getScope().getVariableDeclarations();
 27  4 for (Iterator i = vars.keySet().iterator(); i.hasNext();) {
 28  4 VariableNameDeclaration nameDecl = (VariableNameDeclaration) i.next();
 29  4 if (!((List) vars.get(nameDecl)).isEmpty()) {
 30  2 continue;
 31    }
 32  2 addViolation(data, node, nameDecl.getImage());
 33    }
 34    }
 35    }
 36  4 return data;
 37    }
 38    }