Parameter changes not applied for Cognitive Complexity rule

csharp

(Divya Gupta) #1

Hi,

I have reset the value of Property threshold and threshold for the below rule for quality profile of my organization :

But the change is not reflecting in issues. Tried multiple times. Could someone please suggest on this?
Thanks!!


(G Ann Campbell) #2

Hi,

Let’s start by verifying a few things:

  • You say you reset the parameter values. Are you sure you did it for the profile with which your project is analyzed?
  • Are you sure you re-analyzed the project after updating the rule?

 
Ann


(Divya Gupta) #3

Hi Ann,

Thanks for the reply.
I have verified it and results are as follow:

  1. The profile for which we have set the rule(parameter value) is C# and our project is analyzing that profile.
  2. Yes, we have re-analyzed the project and it is still appearing.
    Could you please suggest?

(G Ann Campbell) #4

Hi,

How about a screenshot of an issue you think should be closed? And also a screenshot of the activation section of your rule? E.G.

 
Ann


(Divya Gupta) #5

Hi Ann,

Please find the screenshot below:

Rule:


(Divya Gupta) #6

Hi,

Also, the screenshot for the issues in a project:


(Amaury Levé) #9

Hi @DGUCOM,

Could you check, on the build machine, the content of the file .sonarqube/conf/cs/SonarLint.xml? It should contain a block like the following and will have some values. Are those values the ones you expect (i.e. threshold: 60 and propertyThreshold: 30)?

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

Cheers,
Amaury


Custom quality profile: overrided rules not reflected in SonarLint.xml file and are ignored in sonarcloud
(Divya Gupta) #10

Hi Amaury,

Thanks for the reply. I checked the file and output is not as expected. Please refer below:

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

(Andrei Epure) #11

Hi @DGUCOM

Are you using sonarcloud :sonarcloud: and BitBucket pipelines? I believe a similar issue has been reported here and it has been fixed in February.

Thanks
Andrei