How to fix such a code duplication problem? Is there a way to mark issue detected by sonar as wrong or not applicable for our case in account?

  • ALM used
    Bitbucket Cloud

  • CI system used
    Bitbucket Cloud

  • Scanner command used

- dotnet sonarscanner begin /k:"$BITBUCKET_REPO_SLUG" /d:"sonar.login=$SONAR_TOKEN" /o:"$BITBUCKET_REPO_OWNER" /v:"${BITBUCKET_COMMIT}" /d:""
- dotnet build Vacancy.sln
- dotnet test Tests/Tests.csproj
- dotnet sonarscanner end /d:"sonar.login=$SONAR_TOKEN"
  • Languages of the repository

  • Error observed

  • Steps to reproduce
    Have multiple class implementations of the interface (general polymorphism approach). Some of properies are marked as duplicated by sonar although they contain different values in implementations.

1 Like

Welcome to the community!

Our duplication detection ignores the values. It tries to look at the shape of the code. So this is by design. And we’re aware that in some cases, for example in declarative code, the result may seem strange.

You can Ignore Duplications, in files matching pattern.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.