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

1 |  | package net.sourceforge.pmd.rules;
2 |  |
3 |  | import net.sourceforge.pmd.AbstractRule;
4 |  | import net.sourceforge.pmd.ast.ASTAssignmentOperator;
5 |  | import net.sourceforge.pmd.ast.ASTExpression;
6 |  | import net.sourceforge.pmd.ast.ASTIfStatement;
7 |  | import net.sourceforge.pmd.ast.ASTWhileStatement;
8 |  | import net.sourceforge.pmd.ast.Node;
9 |  |
10 |  | public class AssignmentInOperand extends AbstractRule {
11 |  |
12 | 10 | public Object visit(ASTExpression node, Object data) {
13 | 10 | Node parent = node.jjtGetParent();
14 | 10 | if ((parent instanceof ASTWhileStatement || parent instanceof ASTIfStatement) &&
15 |  | node.containsChildOfType(ASTAssignmentOperator.class))
16 |  | {
17 | 2 | addViolation(data, node);
18 | 2 | return data;
19 |  | }
20 | 8 | return super.visit(node, data);
21 |  | }
22 |  |
23 |  | }