Sonarcloud is over-reporting duplicated lines on Ruby Rails migrations when

Frameworks

  • Bitbucket
  • Bitbucket Cloud
  • Bitbucket SonarQube pipe - Bitbucket
  • Ruby Rails

The following pull request is marking new code as being duplicated against another file, but when comparing the files they are considerably different. Sonar is reporting 60 lines duplicated, however there are less than 10 lines duplicated as they follow the same structure of creating a table within a Ruby Rails migration.

Here is the link to the pull request: SonarQube Cloud

And the files that are being reported as duplicate are:

  • New = db/migrate/20250312031352_create_special_fee_configurations.rb
  • Existing = db/migrate/20241209124813_create_table_fusion_service_jobs.rb

Please let me know if there is a private place where I can upload these files so you can compare the duplications.

Thanks in advance for your help!

Hi,

Your SonarQube Cloud project is private, so I can’t see the duplications report for myself. But whitespace and string literals are ignored for duplication detection. In light of that, do the findings still seem wrong to you?

 
Ann