10

I want to deactivate a particular rule. I am checking my php code.

Eg: This branch's code block is the same as the block for the branch

This is the rule I deactivate

I go through quality profile-->then click to the php sonar way -->then click on 64 active rules->then I deactivate that rule. Then I logout and login the same bug is visible in the dashboard...

How to deactivate the rule ? Is there any another method ?

13

for some one still looking for a answer like me (it took me few hours to resolve).

  • Firstly, go to Quality Profiles

enter image description here

  • Secondly: Select the profile you want then create a new copy of profile (if you already done this step before, go to the third step). Because Sonarqube does not allow us to change the root profile, so if you want to modify the rules set, you need your own rules.

enter image description here

  • Finally, select your new profile and then modify it as you want

enter image description here

Last but not least, don't forget to set your new profile as default.

5

Follow below steps to disable any rule in SonarQube:

  1. Login by admin

  2. Go to quality profile & Select java/php profile [whichever is appropriate to you]

  3. Enter the rule as key and Search

  4. Uncheck the box which will inactive the rule

  5. Run Sonar runner command once again to verify the modifications are working properly

I have borrowed my answer from here

  • Step 5 is important here, the runner retrieves the rules from the server, processes the data and then publishes the new data with the new rules. – Niels van Reijmersdal Jan 6 '17 at 9:53
3

On newer version of SonarQube (mine is 6.7.4):

  1. Go to http://localhost:9000/admin/settings?category=exclusions
  2. Scroll to Ignore Issues on Multiple Criteria
  3. Add Rule Key Pattern and File Path Pattern
  4. Save and re-scan

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy