net.sourceforge.pmd.rules.design
public class ConfusingTernary extends AbstractRule
//IfStatement[ Statement[2] and Expression[ EqualityExpression[@Image="!="] or UnaryExpressionNotPlusMinus[@Image="!"]]]but "&&" and "||" are difficult, since we need a match for all children instead of just one. This can be done by using a double-negative, e.g.:
not(*[not(matchme)])Still, XPath is unable to handle arbitrarily nested cases, since it lacks recursion, e.g.:
if (((x != !y)) || !(x)) { diff(); } else { same(); }
Method Summary | |
---|---|
Object | visit(ASTIfStatement node, Object data) |
Object | visit(ASTConditionalExpression node, Object data) |