Ordering of Smells in Results window

On the latest SonarLint (8.2.0.68615) on IntelliJ IDEA 2022.3.2, I don’t see a way to change the order of the rules in the report window. After running the analysis on the project it lists the problems by file, then by line. I don’t care about the minor code smells, is there a way to re-order them so I can see the critical smells first, followed by the major etc…? If there isn’t a way to re-order them is there a way to turn off just the minor smells without having to do it from the server which I don’t have access to?

Hello @samuellistopad-8451 and welcome to the Sonar Community forum!

IMO the fundamental reason SonarLint in connected mode with SonarQube is to ensure alignment about Clean Code standards among all the contributors of the project, this is why the code smells are activated or deactivated according to the SonarQube configuration. Of course, you are free to use a different configuration by using SonarLint in standalone mode (you can activate/deactivate SonarLint rules in standalone mode via the IDE settings menu → Tools → SonarLint → Rules)

I don’t care about the minor code smells

Did you configure the Quality Gate so that it won’t fail the pull request with minor code smells? I am interested to understand why you don’t want to see them actually.

is there a way to re-order them so I can see the critical smells first, followed by the major

TL;DR: No.

Issues reported by SonarLint (all of them, not only smells) are sorted by date/time they were introduced (from the most recent to older) - the rationale is that we believe Clean as You Code is the most efficient approach to ensure you build clean code. As part of this approach, we advise to fix any issues (regardless of severity) you just introduced (rather than fixing old existing ones) and BTW focusing on recent issues is what you need to avoid failing your Quality Gate. You can learn more about Clean as You Code here.

Hey Marco, thanks for the perspective.

So at the company our Quality Gate is set up so it only fails if Reliability or Security is worse than A on both new and overall code. There are a lot of code smells that do not effect those ratings. After updating rules there are a lot of code smells, but the blockers for those ratings are minimal. I would like to just see those blockers and fix those so our build process can continue.

Maybe I am missing a setting so I can just see what is failing the quality gate?

As part of this approach, we advise to fix any issues (regardless of severity) you just introduced (rather than fixing old existing ones) and BTW focusing on recent issues is what you need to avoid failing your Quality Gate

I agree that that would make sense on a normal basis. The problem here is that the rules were updated, which causes old untouched files to cause problems. As I said earlier I want to worry about the “new” blockers for now.

Edit:
I see now the stuff from the rule changes does get popped to the top, so that is good. However it is still hard to find when a bunch of smells also got introduced at the same time. So I suppose the question still remains is there a way to just list what is failing the Quality Gate?

1 Like