Reputation: 83
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.
Upvotes: 0
Views: 789
Reputation: 2587
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)
Upvotes: 1
Reputation: 21630
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.
Upvotes: 0