Pull request Decoration reporting old issues, which not part of pull request changes

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

Sonarqube-7.9 LTS
Scanner- 4.0.0.1744

  • what are you trying to achieve
    We are configuring pull request decoration using sonar-scanner/githubEnterprise/Jenkins to publish the reports to sonar dashboard,
  • what have you tried so far to achieve this

sonar-scanner -Dsonar.sourceEncoding=UTF-8
-Dsonar.projectKey=reponame
-Dsonar.host.url=https://localhost:9000/sonar
-Dsonar.login=
-Dsonar.java.binaries=.
-Dsonar.java.libraries=.
-Dsonar.tsql.file.suffixes=sql,tsql
-Dsonar.plsql.file.suffixes=pks,pkb
-Dsonar.pullrequest.key={GIT_PR_ID} \ -Dsonar.pullrequest.branch={GIT_PR_SOURCE_BRANCH}
-Dsonar.pullrequest.base={GIT_PR_TARGET_BRANCH} \ -Dsonar.scm.revision={GIT_PR_COMMIT}
-Dsonar.verbose=true

Problem :
Pull request Decoration reporting old issues, which not part of pull request changes.

SCM collecting changed files in the branch (done) | time=203ms
10:35:29 - 05:05:29.593 DEBUG: SCM reported 9 files changed in the branch

10:36:40 - 05:06:40.548 INFO: SCM provider for this project is: git
10:36:40 - 05:06:40.549 INFO: 7 files to be analyzed

In Jenkins logs we see 7 files analysed , despite we changed only 2 files in the branch.

Thanks

Hi,
The scanner uses git to figure out what files/lines have been modified between the branch and its target, as specified in the parameters.

If you run it with debug logs enabled, you will see the sha1 of the merge base. Could you check if that matches the actual sha1 of the fork point? Have you confirmed that the branch and target are correct as well?