3
votes

I have a requirement to add few more rules to the existing rules. But I am unable to find any way for the latest version of sonarqube i.e 5.1+ Can someone tell me how to do that?

As we know in the latest version, we already have sonarway of rules, which get caught as issues when we run sonar runner for any language specific plugin. I want to add few more rules to the existing rules, which would be caught while running sonar runner.

Manual rules are like we need to do it manually.

I Have done a lot of research before posting the question.

1
@benzonico so we need to code it. I thought, it was just a matter of uploading some xml file. I am not sure ? I new to sonarqube - Susheel Singh
Can you precise in your question what you are trying to achieve ? on which language do you want to add rule ? for which rule engine ? or do you want to tune the quality profile ? It is very hard to help you with so sparse information. - benzonico
@benzonico As we know in the latest version, we already have sonarway of rules, which identifies when we run sonar runner for any language specific plugin. I want to add few more rules to the existing rules, which would be caught while running sonar runner. - Susheel Singh
@benzonico actually php rules which are already present are not enough for drupal standards. We need to add more to it. Before we some option like import an XML which did the job. - Susheel Singh

1 Answers

0
votes

First, the set of available rules is defined by the installed plugins, it does not depend on the version of SonarQube.

Some language plugins support custom rules. As mentioned by benzonico, a documentation on writing custom rules is available. Custom rules can be written in Java or XPath depending on the language plugin.

If you don't want to write custom rules, you have to find a plugin which implements the rule you need. The PHP plugin used to provide some integration with external tools like PHPCodeSniffer and supported the import of a quality profile through XML. However, as mentioned in the documentation of this plugin, that feature was removed in version 2.0.