Issues in New Code Reported on Old Files

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension): * SonarQube Enterprise Edition Version 10.4.1 (build 88267)
  • how is SonarQube deployed: in our Cloud environment

I’m using SonarQubePrepare@5 and SonarQubeAnalyze@5 in my Azure pipeline. I implemented these tasks both for pull request and for main branch.
For the same file (let’s say a.c file), SonarQube finds no issues for the pull request. After the pull request is completed (means changes are merged into main branch), a tag (let’s say V1.1.1) is created on main branch and code analysis is executed on main branch. No issues in new code is reported. Then another pull request (which doesn’t change a.c file at all) is done and a new version V1.1.2 is available on main branch. Now SonarQube reports issues in a.c file in New Code.
New code definition in my SonarQube project: for main branch, I choose “previous version” setting.

My question is why SonarQube reports changes in a.c file as new code which actually was modified in previous version. And changes in the latest version have nothing related to a.c file.

Thanks.

Hi,

It’s difficult to answer this without more context.

This guide may be relevant.

 
Ann