arrow-up icon

Duplicate code view


Duplicate Code Overview Detail Screen

Clicking on a row in the table of duplicate code overviews displays the source code of one pair of duplicate code blocks in the group, side by side. Please review the source code and use it to make a decision for refactoring.
Siderscan detects not only word-for-word identical duplicate codes, but also similar codes with partially changed variable names, function names, variable types, etc. It also detects duplicate code blocks with a few lines of insertion and/or deletion, as long as the logic is almost identical. In the duplicate code shown above:

  • Lines with gray backgrounds are lines that the text is an exact match
  • Lines with pink (or green) backgrounds are lines where the text differs between duplicate pairs, and words highlighted in dark pink (or dark green) are words that the text differs between duplicate code pairs on the left and right.
  • Lines with white backgrounds are lines that are not considered duplicate code blocks
  • + and - next to line numbers follows the diff command notation

In the above example, the entire lines are a duplicate code block. The text strings differ between the left and right codes are lines 894 and 898 of the left code, with the different word highlighted on both sides.

Other functions are as follows:

  1. Displays the unique ID assigned to each duplicate code group. It is a drop-down list, allowing you to select other groups to display.
  2. Show the path of the source code being displayed. If the left and right source codes have different file paths, the different parts are highlighted in yellow.
  3. You can remove this duplicate group from the table.
  4. Statistics for this duplicate code are displayed. A description of each statistic is shown on mouse-over.