All Downloads are FREE. Search and download functionalities are using the official Maven repository.

resources.report.rules.pmd.LogicInversion.html Maven / Gradle / Ivy



LogicInversion

LogicInversion

Use opposite operator instead of negating the whole expression with a logic complement operator.

          
//UnaryExpressionNotPlusMinus[@Image='!']/PrimaryExpression/PrimaryPrefix/Expression[EqualityExpression or RelationalExpression]
          

Example(s):

    
public boolean bar(int a, int b) {

    if (!(a == b)) { // use !=
         return false;
     }

    if (!(a < b)) { // use >=
         return false;
    }

    return true;
}
    




© 2015 - 2024 Weber Informatics LLC | Privacy Policy