I am using SonarQube version 8.2. However, we want to use a rule from the 9.2 version. We are planning on upgrading, but have a release coming up soon and would like to analyze against the 9.2 rule set without upgrading and potentially breaking the server during release.
I have followed the Adding Coding Rules help, but haven’t found what I’m looking for. Basically I would like to extract the rule content from an existing 9.2 rule and then use that information to create a custom rule within 8.2; I am effectively looking to re-create the rule and modify the severity level to match the revised level in 9.2. Any advice on how to do this would be greatly appreciated.
SonarQube 8.2 is not supported anymore. The new LTS version of SonarQube you should upgrade to is version 8.9.x, even before considering moving to SQ 9.2. It will also bring a fair amount of new java and/or C/C++ rules, as well as plenty of updates/fixes for the ones existing already in SQ 8.2.
Regarding adding rules present in 9.2 directly in 8.2 through duplication in a dedicated Custom Rules plugin, I’m sorry to tell you that it most probably won’t work, or at best would require a tremendous amount of work.
The Java rules might be open-source, but they either rely on the latest API of the SonarSource Java Analyzer (and sometimes even SQ API), which evolves over time, or on internals simply not available for custom rules.
The C/C++ rules are not open-source and you won’t be able to duplicate them.
All in all, I believe you won’t be able to duplicate rules from SQ 9.X to 8.2, and I would advise you to simply update your SonarQube version instead.