S121 C# Rule detects issues in SonarLint but not in SonarQube

Hello,

The rule csharpsquid:S121 correctly catches code issues in SonarLint (Rider) but not in SonarQube.

SonarQube 9.9 Enterprise
SonarLint (Rider) 8.5.0.75082
sonar-csharp-plugin 8.51.0.59060 (supplied with 9.9)

In SonarQube it presents with no issue:

But in SonarLint it catches it correctly:

There are no exclusions or custom configurations that might impact. The analysis has been run repeatedly to confirm.

Is there a reason for this, or is this a bug?

With thanks,

Will

Hey there.

S121 is not enabled by default on SonarQube – have you customized your Quality Profile on SonarQube or adjusted the enabled rules in SonarLint?

Hello Colin,

Thanks for the reply.

Yes, the Quality Profile is customised based on a) our coding standards and b) where we see particular coding practises that need attention. We include a number of other plugins to increase rule coverage. I would expect most people would customise their profiles.

However, this is a sonar plugin rule and the user has confirmed they have simply connected Jetbrains Rider to SonarQube, operate in Connected mode and not changed anything.

Is there something that needs to be enabled?

Cheers,

Will

Hey Will.

Regardless of where the rules are coming from (or if many people edit the profile), the question remains if the SonarQube project on the server is attached to the same Quality Profile that is being used by SonarLint for VSCode.

Can you check the Quality Profile tied to this project on SonarQube (Project Information > Quality Profiles used) to see if the rule is enabled on SonarQube?

Hi Colin,

Yes, the rule is enabled in SonarQube. SonarLint was connected in Rider to the SonarQube server and no other changes were made.

Thanks,

Will

Thanks.

To understand that analyzers that run during the build (that pushes the results for SonarQube), can you attach logs from this project (or a simpler project that reproduces the same behavior) with the following level of detail?

Share the msbuild detailed logs

MsBuild.exe /t:Rebuild /v:d

or

dotnet build -v:d

Hi Colin,

Thanks for getting back to me.

We haven’t seen a repeat of this and no longer have the logs, so let’s park this for now. If this is reported again, I will update this and bring logs :slight_smile:

Will