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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.