DuplicatedBlock rule is deprecated but still part of SonarWay

Dear Community!

Environment of the issue:
SonarQube on-prem Version 9.4 (build 54424)

The DuplicatedBlocks rule is marked as deprecated, but still part of the official rulesets across languages. For Example common-java:DuplicatedBlocks is enabled in Java Sonar Way.

Why is the rule still enabled if its deprecated? Is this a known bug in the ruleset?

Thanks and cheers,
Balazs

Thanks for reporting this. I’ve passed the feedback on internally so we can address this.

1 Like

Thanks again @hosszubalazs

These tickets will gradually be implemented.

  1. [SONARSWIFT-512] Remove DuplicatedBlock rule from default profile - SonarSource
  2. [SONARJAVA-4264] Remove deprecated common-java:DuplicatedBlocks rule from Sonar Way - SonarSource
  3. [CPP-3715] Do not enable deprecated DuplicatedBlocks rule in Sonar Way profile - SonarSource
  4. [SONARPHP-1301] Remove deprecated DuplicatedBlocks rule from Sonar Way - SonarSource
  5. [SONARCOBOL-1626] Remove deprecated DuplicatedBlocks rule from Sonar Way - SonarSource
  6. [SONARVBSIX-303] Remove deprecated DuplicatedBlocks rule from Sonar Way - SonarSource
  7. [SONARABAP-429] Remove deprecated DuplicatedBlocks rule from Sonar Way - SonarSource

Thanks for the followup!

Wait. Stop. Showing problematic places like Code-Duplicates is a core task of Quality-Management. The purpose of SonarQube. Why does this rule get removed completely, or at least gets removed from the default rules?!
I’m baffled.
I assume this is a misunderstanding?
Could you please explain this?

Hey there.

Thanks for your concern. Detecting code duplication is not going away from SonarQube, but the rule that raises a file-level issue when a duplicated block is found in a file is going away.

  1. This rule is too strict, as it effectively enforces 0% duplication for all files
  2. Rules like this really don’t map to our Clean as you Code philosophy, because it only ever looks at overall code (no differentiation between old code and new code)
  3. There are Quality Gate conditions to flag a project/pull request when duplication has exceeded a certain threshold. These can be applied on new code and/or overall code. We think this is far more useful and relevant.

All other features in SonarQube related to duplication are staying put. This single rule is now deprecated and will be removed in SonarQube 10.0

I hope this helps.

1 Like

Thanks for this quick, informative and helpful response :slightly_smiling_face:.