Custom quality profile: overrided rules not reflected in SonarLint.xml file and are ignored in sonarcloud

Azure devops, .Net, msbuild
We have a custom Quality profile for C# (default and affected to our project) wich is overriding rule S3776 (we changed the severity + threshold). When we run the analysis in Azure devops we are getting the right quality profile however Sonarcloud is not considering our custom rule settings for the analysis. By checking the .sonar/conf/cs/SonarLint.xml file I figured out that the values are wrong.

Here a sample I did which reproduce the issue.
https://sonarcloud.io/project/issues?id=msc.sandbox.appollo&pullRequest=53&resolved=false

Please let me know if more information is needed.

Thanks for your help.



Hi @ghaouim,

Your issue seems related to another we have. Could you please follow these steps: Parameter changes not applied for Cognitive Complexity rule and tell me whether the file contains the values you expect.

Cheers,
Amaury

Hi @Ammo,

Sorry to intrude on this topic but I believe both the problems @ghaouim and @DGUCOM (not sure if Azure DevOps is being used in that situation) are experiencing might be related to the issue I reported last week.

I tried using SonarCloud with Azure DevOps and observed that the pipeline extension doesn’t provide the MSBuild scanner with a value for the organization where the quality profile has been created on.
The end result being that the scanner always uses the default Sonar way quality profile when performing the analysis.

As stated in said issue I couldn’t determine a work around for this.

Also my apologies if I end up being wrong in my assumption.

Hi @twaalewijn,

Thanks for this feedback! I will have a look and get back to you quickly.

1 Like

Hi Tim,

I think you are right. We are using Azure Devops.

1 Like

I can confirm you that the SonarLint.xml file contains the wrong values (default values instead of custom)

<Rule>
  <Key>S3776</Key>
  <Parameters>
    <Parameter>
      <Key>threshold</Key>
      <Value>15</Value>
    </Parameter>
    <Parameter>
      <Key>propertyThreshold</Key>
      <Value>3</Value>
    </Parameter>
  </Parameters>
</Rule>

Thank you @twaalewijn for your reply. In my case the organization is correctly set and used and the analysis are pointing to the right quality profile. I have checked even the call made by azure devops sonarcloud extension to sonar cloud server in order to retreive the quality profile settings and they were correct. The settings are incorrect in the sonarlint.xml file.

Hi there,

Sorry for the late announcement but as you might have seen we did release a new version of the AzureDevOps task which fixes the issue you were mentioning.

Please, if you haven’t yet, update your version and let us know if the issue is properly fixed on your side!

Thanks,
Amaury