Sider Labs can analyze your code clones in various ways. In this article, we will explain how to use the code clone visualization feature in the “Overview” tab.
The Overview tab has a clone visualization panel. The wheel view extracts only the files that have code clones out of all the files in the project and illustrates the relationship between the files that have the clone code. The files in your project are displayed along a circular ring. The arcs that connect the ring fragments show the clones that exist between the two files. The width of the arc corresponds to the number of statements in the clone code, and you can click on the arc to view the actual code of the clone. On the other hand, clones inside the same file are represented as “bumps” on the circle. If you see an arc that is somewhat large and spans between two different files, we recommend you to check the details of the clone. You may be able to increase the code quality by grouping them together as utility functions or classes.
For example, the figure above shows an analysis of the repository of a 3D image processing software. There are more than 10 clone pairs with the number of statements ranging from 30 to 150 between “vmBlockVolume.cpp” (yellow) and “vmBlockVolume.cpp” (pink) (red dotted line in the lower right of the figure).
In the case of very large projects, the file names and arcs in the wheel chart are sometimes almost invisible. We keep trying to improve the UI/UX in the future, but if you mouse over a ring fragment in the wheel chart, complete file names will be shown. You can also zoom in by clicking the “Zoom In” button on the top right of the diagram. It is also possible to draw the top 10 most important files only or the top 10 largest scattered clones. Happy refactoring! Translated with www.DeepL.com/Translator (free version)