Dotnet XML comments picked up as duplicate code

  • ALM used: GitHub
  • CI system used: Github actions
  • Languages of the repository: C# (dotnet 3.1.x)

Hi, so my Sonarcloud scan is picking up XML comments (used for Swagger documentation) as duplicated code. Anyway to ignore this or work around it?
Dotnet uses XML comments to describe methods, which Swagger then uses to generate some documentation. It is picking up some duplicate blocks but this is expected for endpoints which have mutual fields.

1 Like

Welcome to the community!

Iā€™m afraid the only available workaround is to exclude the affected files from the duplication calculation, as documented on our Narrowing the Focus page: go to Administration > General Settings > Analysis Scope > Duplications and set the Duplication Exclusions property.