Locating duplicated code with Sonar

All duplication metrics are accessible from the project dashboard beside the Comments section. Notice how the metric in the large font is highlighted to alert us that the duplication levels are above five percent. All metrics are hyperlinks allowing us to drill down and locate the source.

Locating duplicated code with Sonar

Click any of the first two metrics (percentage and number of physical lines) to navigate to the drill down screen. From left to right, you can see three panels (Project, Package, and Class) with the leftmost one listing all classes that contain duplicated code. The number next to a class name is the number of physical lines duplicated. ...

Get Sonar Code Quality Testing Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.