SonarQube Version: SonarQube Server v2025.1.1
Deployment Type: ZIP Installation
What are we trying to achieve?
We would like to reduce the number of duplicated lines of code reported by SonarQube where the duplication appears to be identified incorrectly across different projects within the same source repository.
Project Structure
Under our SourceCode folder, we have multiple ASP.NET projects, for example:
SourceCode/
├── ProjectA/
│ └── Program.cs
├── ProjectB/
│ └── Program.cs
Issue Description
During analysis, SonarQube is reporting more than 50 duplicated lines in the Program.cs files across different projects. However, this appears to be a false positive from our perspective.
In ASP.NET applications, Program.cs is a mandatory entry point file, and it is expected that multiple projects contain very similar or identical startup and configuration code. The duplicated code is not the result of copy-paste between projects but rather follows the standard ASP.NET application structure and framework requirements.
Since ProjectA and ProjectB are owned and maintained by different development teams, centralizing the shared startup logic is not a feasible option. Any changes required for one project may not be suitable for the other, and maintaining a common shared implementation would introduce additional management and dependency challenges.
Request
Could you please advise on the best approach to handle this scenario?
Specifically, we would like to know:
ur primary question is whether SonarQube can be configured to avoid comparing code duplication between ProjectA and ProjectB. Since these are independent projects maintained by different teams, we would like duplicate code analysis to be performed within each project individually rather than across projects. Is such a configuration supported, and if so, what is the recommended approach?
Any guidance or recommendations would be greatly appreciated.
Thank you