Inspection that can extract common parts from branches of if statement.

Before:


  if (x > 12) {
    doSomethingBefore();
    doSomethingDifferent1();
    doSomethingAfter();
  } else {
    doSomething();
    doSomethingDifferent2();
    doSomethingAfter();
  }

After:


  doSomethingBefore();
  if (x > 12) {
    doSomethingDifferent1();
  } else {
    doSomethingDifferent2();
  }
  doSomethingAfter();

Updated in 2018.1