Skip to content

sonar.cxx.metric.cpd.ignoreLiterals

guwirth edited this page Mar 10, 2021 · 4 revisions

The configuration parameter sonar.cxx.metric.cpd.ignoreLiterals is used to configure the metrics Duplications (Copy Paste Detection). The configuration can be done in the file sonar-project.properties or in the SonarQube UI under Administartion > Configuration > CXX.

sonar.cxx.metric.cpd.ignoreLiterals=True ignores literal (numbers, characters and strings) value differences when evaluating a duplicate block. This means that e.g. foo=42; and foo=43; will be seen as equivalent.

int a = 1;
int a = 2; // with 'ignoreLiterals=True' detected as copy from line above

The metric is displayed in the SonarQube UI under Project > Measures > Duplications.

Example:

sonar.cxx.metric.cpd.ignoreLiterals=False
Clone this wiki locally