I’m facing a problem in pointing Sonar rules in the Sonar server. For the newly added rules, the link doesn’t work with the parameters that I was using before.
old - https://my_sonar_server/coding_rules?languages=cpp&open=cpp:S3805 (works)
new - https://my_sonar_server/coding_rules?languages=cpp&open=cpp:S7116 (doesn’t work)
The new rules works by passing different parameters
https://my_sonar_server/coding_rules?rule_key=cpp:S7116&open=cpp:S7116 (works)
This is a problem for me as I’m computing the link for the rule (by adding the parameters in our automation) which we are using in a document for reference and it become invalid for newly added rule due to parameter change in URL, hence we have to change the parameters as it got changed recently.
Not sure if it’s reliable to depend on the current parameters for rule URL. Can you please suggest?
In short, you can rely on the following format already shared earlier: /coding_rules?open=java%3AS2204&rule_key=java%3AS2204
This is not going to change, and in fact, this is the only reliable way for the rule to be shown (at least now). By the way the same format is used if you copy permanent link from UI by clicking copy button
I agree that the behaviour of open query param is really counter-intuitive , but this param won’t guarantee that rule’ details will be shown, therefore rule_key has to be added in order to filter list of rules by the rule you are looking for.
With that, we probably can improve this behaviour, I’ve added a ticket to our backlog.
You can generally rely on it for reference and documentation, but keep in mind that it is is always kept current with the latest set of rules released by SonarSource. Your organization’s SonarQube instance may not always use the very latest version of SonarQube.