Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change severity of the rule in sonar?

Tags:

sonarqube

Can anyone tell me how exactly to change severity of the rule in sonar? There is a special section in sonar for activities like this - Quality Profiles. But the opportunity of changing severity is disabled.

How to make it enabled? Maybе I need some special rights for those activities? If so, what are these rights?

Thanks in advance.

like image 679
user2870099 Avatar asked Oct 11 '13 08:10

user2870099


People also ask

How do I modify SonarQube rules?

There are three ways to add coding rules to SonarQube: Writing a SonarQube plugin in Java that uses SonarQube APIs to add new rules. Adding XPath rules directly through the SonarQube web interface. Importing Generic Issue Reports generated by an independently run tool.

What is change severity SonarQube?

If you're in connected mode then SonarLint is getting its data about existing issues from SonarQube. And until the next analysis, the severity of that existing issue is still what it was before you changed the rule severity. You see, there's no continuous relationship between a rule and its issues.

What is change severity?

Severity change - This is the middle ground between the first two options. Yes, it's a problem, but it's not as bad a problem as the rule's default severity makes it out to be. Or perhaps it's actually far worse. Either way, you adjust the severity of the issue to bring it in line with what you feel it deserves.

Which is wrong severity in SonarQube?

In SonarQube context, we are using the types and severity provided by SonarQube, it is not possible to set any severity you may want. So despite the fact that scapegoat refers to it as an “error”, I think it makes sense to set it as a minor bug. Hope it clarifies the situation.


2 Answers

In versions prior to 3.6, management of quality profiles is restricted to system administrators.

Since SonarQube 3.6, there is a dedicated "Administer Quality Profiles" permission.

See Quality Profiles in the SonarQube documentation.

like image 121
Mithfindel Avatar answered Oct 26 '22 01:10

Mithfindel


These steps apply to sonar 6.7

  1. Create a new profile my way by copying the default.

enter image description here

  1. Activate that profile for your sonar project

enter image description here

You may also want to set that profile as a default

enter image description here

  1. Open the new profile my way

  2. Deactivate the rule you want to change

enter image description here

  1. Activate the rule again.

Get id in description:

enter image description here

Search for id in rules:

enter image description here

Finally you can set a new severity level (You'll find the activation button at the button of the description)

enter image description here

like image 40
Matthias M Avatar answered Oct 26 '22 03:10

Matthias M