SonarQube still showing new lines after the reverted commits also

Hi Community,

we are using sonarQube 8.9.1 community edition.

We made a change a line of code in java source file on 27-Feb-2022, then reverted back on the same day. But sonarqube is showing as new code changes for this file.

The leak period for New code is last 70 days.

Can i know what is reason for this?

Regards,
Naresh

Hi Naresh,

When you go to the file in SonarQube and click on the margin of the changed/reverted line(s), what date is shown in the ‘blame’ data SonarQube pulled from your SCM?

 
Ann

Hi Ann,

In the blame data it is showing committed on 27-Feb-2022. we committed the line on same day and deleted on same day. But still sonarqube showing as new line change. We set leak period for new code period as last 70 days.

Thanks,
Naresh

Yes , the blame data is pulled from SCM…we are able see the author information

Hi,

SonarQube marks code new or not based on the date your SCM provides. Since your SCM is providing the date of the reversion, SonarQube marks it as new.

 
Ann

Hi Ann,

we deleted the new line on the same day…in the bit bucket repository the new line is not avilable…but the sonarqube is still showing in the dashboard as new line

Thanks,
Naresh

In another project we created a new line on 27-Feb-2022 and we deleted the same new line on 8-Mar-2022. Still the sonarqube dashbaord showing the deleted new line, but the new line is not available in the bitbucket repository.

Regards,
Naresh

For some of the projects it is working fine but some projects we are facing this issue. Is we need to change any configurations in the SonarQube?

Hi,

We go by what your SCM says. Your SCM says the lines are new, so SonarQube does too. There’s nothing to adjust here.

 
:woman_shrugging:
 Ann

Hi Ann,

Yes it is correct. But we are facing a strange issue for some applications. We deleted the line and committed it, but the deleted line still showing in sonarqube . In the SCM Repository the deleted line is not available.

Is any configurations changes causing the issue

Hi,

Have you re-analyzed since you deleted the line?

 
Ann

yes Ann,

we rebuild the job

Hi,

How about a screenshot of the deleted line in SonarQube, along with the ‘blame’ information (click in the left margin to display it)?

 
Ann

Hi Ann,

Due to security reasons we are not able to take screenshots.

We verified in sonarqube, the deleted line showing the commit hash ID, commit date and author name. The commit date showing in the blame data is actual commit date. Still we are able to see the blame data post delete the line>

Hi,

I’m really not sure how I can help any further.

 
Ann