Problems with code duplicated


we are using sonarcloud to improve the quality of our code. We have a laravel (PHP) project and SonarCloud is very punitive with our Services, which have similar structures because of same actions like, for example: List Something (Hotels, Clients, etc…).

That’s why the analysis of this project is failing by now as we already exceed the 3.0% of code duplication and it’s something that keeps growing at the moment.

It is not duplicated code, it is similar services. How could we avoid this?



Hello @jordimirobruix,

We currently have no way to mark code duplication as ‘Won’t fix’ like we do for code smells.
I would advise you to adjust the percentage of duplication you allow on your quality gate, or to exclude the relevant files from the duplication detection. This can be done by navigating to SonarCloud > ‘Your Project’ > Administration > General Settings > Analysis Scope > Duplications.

Hope that helps,