Duplicated Code in Conditional Branches (DCCB)

Description:

DCCB detects conditional statements where both branches have the same code. Such code should be moved outside the conditional branches.

Example:

In the following example, both then and else parts of the conditional statement assigns to v. This assignment should be done only once immediately after the conditional statement.

   if (index > limit) {
       index = 0;
       v[index] = val;
   } else {
       index = max(index, limit);
       v[index] = val;
   }