Chapter 8. Working with Duplicated Code

In this chapter, we will review how Sonar tracks duplication in our software application. Sonar features four essential metrics to measure duplication across projects and presents metrics in a widget format inside the project dashboard. Knowing the metrics and having created an alert when duplication metrics , we will take a look at the widget and use it to effectively drill down to our source code, locating duplicated lines and blocks. To get a top-layer view, we will use the Radiator component, as it is ideal to highlight duplication spread for large projects.

In this chapter, we will cover:

  • Code duplication
  • Sonar code duplication metrics
  • Locating duplicated code with Sonar
  • The Useless Code Tracker plugin

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.