Declare custom rule type as Vulnerability in SonarQube 6.3

439 views Asked by At

I am using sonarQube 6.3 and when adding new custom rules for Php or Javascript, they are by default declared as Code smell. I would like to declare them as Vulnerability or bug.

Here is an example of a rule declaration

@Rule(key = "Rule1", priority = Priority.MAJOR, name = "Rule 1 sould be used.", tags = {"suspicious" })

Is there a way to do it?

1

There are 1 answers

0
Julien H. - SonarSource Team On BEST ANSWER

There is a way to set the rule type using some special tags.

  • Tag "bug" means type "bug"
  • Tag "security" means type "vulnerability"

So try for example:

tags = {"suspicious", "bug"}

NB: This is documented in API Javadoc (but hard to find I admit)