SonarQube S1128 Rule - Version Drift Issue

Greetings Community,

I’m using both Community Edition - Version 9.4 (build 54424) and Community Edition - Version 8.9.2 (build 46101).

When it comes to findings (Code Smells), more specifically the Unnecessary imports should be removed (S1128) Rule, there’s a discrepancy between the 2 SonarQube versions.

In 8.9.2 version, the S1128 rule resulted in 13 findings both in java and typescript files, while in the 9.4 resulted in 3 findings, java and typescript files as well. These files are included in 8.9.2’s findings.

For those 3 files, I cannot discern any differences in code, on how the rule is applied differently. I’m aware that the Rule Set is aligned with SonarQube’s version, so S1128 exists in both versions, but in 9.4, maybe it’s updated and uses a different approach on how it should flag a line of code as an “unnecessary import”.

So why does this occur? Is there a way it can be tackled?

Kind regards,
Chris

Hi Chris,

We’re continually refining existing rules, so this difference is due to an update of the rule implementation.

Did you mean to ask about tracking? Because here’s the Jira ticket for that improvement. In general, you can check the SonarQube Release Notes for “Improve [language] analysis” tickets, which will have links to the release notes for the underlying language analysis.

 
HTH,
Ann

Greetings Ann,

Thank you so much for your reply.

No, I meant to ask if there’s a way I can overcome this situation, like downgrading or upgrading the S1128 rule in one of these two instances so it’s aligned or there’s nothing that can be done?

Best regards,
Chris

Hi Chris,

The only way you can true these up is to true-up the versions. I.e. bring both of your instances up to 9.5 (because that was released recently :wink:)

 
HTH,
Ann

1 Like

Thank you so much Ann.

Cheers,
Chris

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