Do anyone knows how to increase the cognitive complexity threshold in Sonar Portal
? I searched in the portal but I could not find any clue on it.
Default is 15
, I want to increase it to 25
If you're using the Sonar way profile, you'll find that it's not editable there. In that case, you'll need to make a copy of the Sonar way profile and edit the parameter there. Then either set your new profile as the default, or explicitly assign the relevant projects to be analyzed with it.
SonarQube calculates the number of “if” conditions, nested loops like “for”, “forEach”, “do-while” and also “&&” and “||”. So, we have here complexity of 4 conditions. One of the possible solutions — move the logic of && conditions to another separate method. and call it like this.
You need to edit the value of the rule parameter in the appropriate profile. If you're using the Sonar way profile, you'll find that it's not editable there. In that case, you'll need to make a copy of the Sonar way profile and edit the parameter there. Then either set your new profile as the default, or explicitly assign the relevant projects to be analyzed with it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With