How to close specific rule in sonar? - sonarqube

I want to disable this rule for the sonar cloud, where can I configure it?
I have looked up the sonarqube doc. Unfortunately, I didn't find the rule.
https://rules.sonarsource.com/javascript/tag/react

As someone answered early, add these 2 lines to sonar-project.properties will close this rule globally.
sonar.javascript.jsx.lint.props-should-not-use-functions.severity=none
sonar.javascript.jsx.lint.props-should-not-use-arrow-functions.severity=none

Related

Disable Builtin Rules from 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.

Is there a way to ignore Sonar issue "common-java:InsufficientCommentDensity" for whole project?

I'm working on the project, where the developers are trying to write understandable code, so there is no sense to use comments in a lot of places. We have a SonarQube, which is used in other projects and we cannot configure it. All we can do is configuring Sonar in our project's POM file. SonarQube is complaining, that there are not comments in our code with the rule "common-java:InsufficientCommentDensity". I know, that we can ignore some rules using sonar.issue.ignore.multicriteria properties like
<sonar.issue.ignore.multicriteria>junit.assertions.include.messages</sonar.issue.ignore.multicriteria>
<sonar.issue.ignore.multicriteria.junit.assertions.include.messages.ruleKey>squid:S2698</sonar.issue.ignore.multicriteria.junit.assertions.include.messages.ruleKey>
<sonar.issue.ignore.multicriteria.junit.assertions.include.messages.resourceKey>**/*.java</sonar.issue.ignore.multicriteria.junit.assertions.include.messages.resourceKey>
but it's not working with "common-java:InsufficientCommentDensity" rule. Why? And is there a way to ignore this rule in our case?
SonarQube version is 6.7 (build 33306)
Sonar Maven Plugin version is 3.4.0.905
I tested this quite a lot and finally found that setting common rules (anything that starts with "common-xxxx") from scanner side (pom, command line etc) will be ignored and wont work. The language specific rules can be passed as command line arguments and thats why the "squid:S2698" rule is getting ignored correctly. Here is the issue link on the SonarQube JIRA board and it says that it "wont be fixed".
https://jira.sonarsource.com/browse/SONAR-8230
The only option for you is to set the issue exclusion from UI. Here are the steps to set it from U.
If this is a common rule that you want to ignore, then make sure you have admin rights to your project. On the project Dashboard you should see the administration tab:
Click on Administration → General Settings
Click on Analysis Scope on the left hand side
Now set the below property:
Save and run the scan again.

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 - 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.

how to disable some issue in sonar metrics?

It is possible turn off some issue checking in sonar projects and how to do it? I want to for example disable "Tabulation characters should not be used" or "Modifier Order".
Thank for help.
If you would like keep the rule active while excluding certain parts of your source-code, you can use features of the the switch-off violations-plugin.
The plugin was deprecated with sonarqube 4.0, as it is now possible to use integrated features described in this part of the sonarqube-documentation:
http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus
If you are using an older version of sonarqube you find the plugin here:
http://docs.codehaus.org/display/SONAR/Switch+Off+Violations+Plugin

Resources