O'Reilly logo

Sonar Code Quality Testing Essentials by Charalampos Arapidis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sonar code duplication metrics

Sonar uses the following four metrics to cover code duplication. Duplicated lines can also be expressed as a percentage value and we will create an alert with a threshold value of five percent.

Name

Description

Duplicated Lines

Number of physical lines touched by duplication.

Duplicated Blocks

Number of duplicated blocks participating in duplication.

Duplicated Files

Number of files containing duplicated lines or blocks.

Density of Duplicated Lines

Sonar code duplication metrics

Creating Duplicated Code Alert

Log in to Sonar and navigate to the custom packt profile configuration screen. Add a new alert as shown in the following screenshot: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required