Disable Builtin Rules from sonarqube - sonarqube

I need to Disable the builtin rules which is present in SonarQube
It is throwing many bugs because of the below rule
I tried removing it , since it is a builtin rule i could not find any option for removing the rule
<strong> and <em> tags should be used -> it is considered as a bug in sonarqube
Please provide the solution for removing the above rule from the rule list of the sonarqube of my project

You can not deactivate rule in a built-in profile. You will need to create your own quality profile (click on Quality Profile menu). Once you have your own quality profile you can activate/deactivate/customize rules at will.
Don't forget to associate the profile with your project or set it as a default afterwards.

Related

How to deactivate a rule in sonarqube commercial?

I am using sonarqube developer's edition and i cannot see any options to deactivate a active rule in any quality profile as there was in basic version.
Can anyone please give me an idea as to to deactivate any active rule while using sonarqube commercial?
Thanks
You can't edit built in profiles. Probably what you want to do is
create a new profile, say P1
set it as the default
copy into it the rules from the profile you have been using
edit (add/delete/update) the rules in P1 to meet your needs
Alternately, 'P1' could inherit from Sonar way, but then you wouldn't be able to remove rules that were added by inheritance, only edit (presumably downgrade) their severities. You would still be able to add new rules and then subsequently remove those rules you had added directly.

SonarQube rules are not getting detected

I'm a big fan of SonarQube as a developer. This time though I need to do admin work since I need to configure it from a fresh install. I see this rule in SonarQube "Methods should not have too many lines" but I don't see that it belongs to any of the default profiles ("FindBugs+FB-Contrib", "Sonar Way"). I think that's the reason I don't see any rule violations of this type from any of the projects. I thought this should be part of a common default profile since this is a pretty common violation. How can I add this rule to the profile?
There are other rules that I need to add which I expected also to be in the default/available profiles already.
You can't edit built-in profiles. Instead, you'll have to create a new profile, and then you'll be able to edit the rules to your heart's content. I suggest you initialize your new profile either by copying the rules from the built-in profile of your choice, or by inheriting from that profile. Note that choosing the latter means your profile can (and probably will) be updated by upgrading your analyzers; each new version of SonarJava, for instance, implements new rules and many of them are added to the Sonar way profile.

SonarQUBE - how to deactivate a rule (bug/pitfall) in a default Quality Profile?

I have the default profile for JAVA in SonarQUBE as Sonar way.
Now, when I try to deactivate any rules in it, there is no way I can do it.
How do I specifically disable rules for this profile?
You do not. Starting with SonarQube 6.5 default profiles are not editable. Instead, make a new profile and copy the Sonar way rules into it. Then you'll be able to edit your copy.
If after each upgrade you want to make sure you haven't missed any exiting new rules, just compare your copy with Sonar way and edit your profile to handle the differences.

Rules created via plugin are not active in Quality Profile

I am testing the creating of a Sonarqube plugin for a custom language.
I followed Sonar's examples (https://github.com/SonarSource/sonar-examples/tree/master/plugins/sonar-example-plugin/src/main/java/org/sonarsource/plugins/example) and I have defined a Language, a Quality Profile and a set of Rules (using NewRepository and NewRule).
When I go to the UI I see the Language, the Quality profile and the Rules, but all the rules are inactive (In Quality Profile they are listed as inactive) and in Rules I can only see them if I filter by Inactive.
When I open a rule the item "Quality Profile" is empty in the rule detail page, but the rules list when I filter by my custom Quality Profile.
I don't see any way to activate them, nor in the UI nor using code.
I would prefer to use code, I searched lots of examples and I cannot find what is missing.
Indeed, the sonar-examples was not up-to-date and no rule were activated. I've fixed this in the following commit : https://github.com/SonarSource/sonar-examples/commit/2cdcc48236fae294d750ca25b575222eb2b40b47.
In your plugin, you need to activate some rules in the FooQualityProfile (see how to do here : https://github.com/SonarSource/sonar-examples/commit/2cdcc48236fae294d750ca25b575222eb2b40b47#diff-7d0f822469998cf7d71a3e3da3972e8cR40)
The ability to turn on a rule is listed on the Rules page. Only administrators in Sonar can 'Activate' a rule within a quality profile. Each language has a default quality profile. Look carefully at the Rule in SonarQube towards the bottom to see the activation link.

SonarQube: Profile inheritance and rule deactivation

I've read the docs about profile inhertiance [1]. They say that "A rule inherited from a parent cannot be deactivated". Is this on purpose and will it be supported in the future?
When I upgrade some plugin (i.e. the JavaScript analysis plugin) there are new rules and I have to restore the built-in profile "Sonar Way" in order to get the new rules. However when I do this I lose all the previous configurations (deactivated rules) and I have to remember what I've done in the past and repeat that again.
It sounds like you're using the built-in profile as your default profile. If you're happy with the built-in profile as-is, then that's a great way to go. But it sounds like you're not. So instead, I'd suggest you make a copy of Sonar Way, I'll call it 'Copy', and set it as your default profile. Then after each upgrade, you can reset Sonar Way, use the comparison service to see the differences between Copy and Sonar Way and then choose which new changes to apply in Copy.

Resources