scratchpad

These are new rules that are still in progress

IfElseStmtsMustUseBracesRule

Avoid using if..else statements without using curly braces

This rule is defined by the following XPath expression:

  
  //Statement
   [parent::IfStatement]
   [not(child::Block)]
   [not(child::IfStatement)]
  
               

Here's an example of code that would trigger this rule:

			
 

   public void doSomething() {
     // this is OK
     if (foo) x++;

     // but this is not
     if (foo)
         x=x+1;
     else
         x=x-1;
   }