Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

custom rule using xpath

Developers
2012-04-26
2012-10-07
  • Hi,

    I have the following code in my java class:
    if(Logger.enable()){
    Logger.fine()
    }

    but sometimes we just write:

    Logger.fine();

    but we want to avoid this.

    I have tried to make a rule for this using xpath

    //ClassOrInterfaceBodyDeclaration//MethodDeclaration//StatementExpression//Pri
    maryExpression//PrimaryPrefix and ..//..//..//..//..//..//..//IfStatement//Exp
    ression//PrimaryExpression//PrimaryPrefix

    The basic idea behind it is that when condition is true we need to evalute the
    other condition and it must also be true.
    Did I miss anything?

    br,

    //mike