Put rule key in issue box

SQ 8.6:

When looking at issues, either by going through the issues tab or the code tab, the box that shows an issue shows much useful info, including the line number of the code, but not the rule’s key. One has to click on the “Why is this an issue?” link to get the popup that gives the key.

Sometimes it’s hard to tell exactly which rule is being violated since the text in the box isn’t always the base name of the rule, but is adapted to the specific code. If one is familiar with some of the key names then one could see right away which rule it is.

There seems to be space available in the box, but if not, the phrase “Why is this an issue?” could be replaced with simply “Why?” (still more clear than the ellipses in older versions).

Hi @MisterPi,

Thank you for your suggestion :slight_smile:
Before discussing potential UI fixes let me ask a question which might sound a bit naïve. Why do you feel the need to know which rule raises the issue? Did you see issues which were hard to understand? Maybe we can improve these issues’ messages, or highlight different parts of the code.

I have the feeling that if developers rely on the rule key to understand an issue we might have a bigger problem. Rule keys can be useful when reporting a SonarQube bug or false positive. However they are not supposed to carry any meaning. Actually they change quite often as we split/merge/rewrite rules. Relying on them would also mean that developers who do not know these identifiers have a hard time using SonarQube/SonarCloud/SonarLint.

Cheers,
Nicolas

Often, the text that is displayed for a given issue is different from the name of the rule. Sometimes the former is in imperative mood (“Move this variable to comply with Java Code Conventions”) while the latter is in indicative mood (“The members of an interface or class declaration should appear in a pre-defined order”) – examples are from rule squid:S1213 on an old server but the same thing applies to the new versions. Clearly SQ is trying to adapt to the specifics of the line of code being flagged – this is a good feature (don’t get me wrong). So I’m not asking to REPLACE it with the rule key, just tuck the key name in the corner of the box somewhere.

Often when I’ve been adjusting quality profiles, I become familiar with certain keys, the ones I’ve been switching on/off or such. So if I see an issue with a message I’ve never seen before, if I see the key I can say, “oh, it’s that rule…” without having to click on the “why” link to find out.

In other words, just a shortcut.