Looking For Duplications
Add the Duplications widget (was Comments & Duplications prior to version 3.7) to widget to your dashboard:
From there, you end up in the component viewer:
By default, the scope of duplication detection is the project for standard projects and the module for multi-module projects. To detect duplications between the modules of your project and between the different projects analyzed on your SonarQube platform, log in as a a System administrator, go to Settings > General Settings > General > Duplications and set the Cross project duplication detection property to true. Then Then run another analysis on your projects. You also have the option of setting this at the project level: Configuration > General > Duplications.
- For technical reasons, cross module duplications will be be detected only after the second analysis of your project.
- Cross project duplication detection is automatically disabled when analyzing a project with the
- Always check for duplications in a file before modifying it. If there are any, either:
- Analyze those duplications and eliminate them by using inheritance or other suitable patterns (do this only if you have unit tests on the blocks to change)
- Or do Do not forget to replicate your changes wherever it is necessary on the duplicated blocks
- Use the Issues and Technical Debt mechanisms to help you monitor the cost and and track the remediation of this sin by editing your Quality Profiles to include the Duplicated Blocks rule from the Common Sonar repository.