Sort Issues by creation date

Must-share information (formatted with Markdown):

Sonarqube - 9.9
Plugin - org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar

I have created a feature branch out of my main branch and ran the Sonar scan on it using maven command and giving the Dsonar.branch.name=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME, now my question is can I sort the issues according to creation date? Essentially what I mean is that if there is a new issue that got created (even if its on old code), that should come on top.
Currently I can see that there are Filters option, is there any sort options available as well?

Hey there.

It’s not possible to sort the issues, so if you want to see the newest issues, you’ll need to set a recent date range under Creation Date.

If I set the recent date range, then for a feature branch it shows all the issues ever created, probably because this is the first time that the branch is getting recorded on Sonar. And the issues that happened specifically because of my feature branch, they get lost somewhere in the long list. We have more than 1k smells.

Out of curiosity, why doesn’t Sonar have a sort option, isn’t that an easy to implement feature?

It shouldn’t work that way, as Issue Backdating should kick in (setting the issue creation date to when it was introduced in SCM).

I’m not sure! I think we’ve focused more on having users focus on New Code rather than raw creation date.

It shouldn’t work that way, as Issue Backdating should kick in (setting the issue creation date to when it was introduced in SCM).

It is working in a strange way, if I am running the full branch analysis on the feature branch, a lot of smells are being timestamped with the first analysis of feature branch and rest of them previous to that. Attaching a screenshot as well
Screenshot 2024-07-03 at 12.43.04 PM

My original issue is below -

Below is the code on master branch -

private static final String DB = "db";
System.out.println(DB)

Below is the code of my feature branch where I introduce a new constant and start using that, but forget to remove the old constant which has now become unused

private static final String DB = "db";
private static final String NEW_DB = "new_db";
System.out.println(NEW_DB)

so now the constant DB is unused and if I run the full branch analysis, this new smell on the old code should ideally be shown at the top. Is there anyway to achieve this?

Hey there.

Are all of your files/commits checked into git (with the scanner running from a CI), or are you running these analyses manually (executing the scan from your local machine, with some changes possibly not checked into git?)

In the example you’ve given – you will be able to filter on “Issues on New Code” to see the new issues raised even on lines that haven’t changed (this is useful, but it’s rather annoying that on Pull Request analysis, these are the kind of issues that specifically don’t appear)