I run a build from Jenkins with the command given above, but I get strange behavior related to the raised issues. The analyzed branch is a short-lived branch created from a long-lived branch.
Should there be a sonar.branch.target in the command above ?
I added the parameter (hard-coded for now) sonar.branch.target=develop for the analysis which are not pull request, and I new get correct results.
But when I am in the pull request mode, by using the parameters:
sonar.pullrequest.key=...
sonar.pullrequest.branch=...
sonar.pullrequest.base=develop
with the same branch, I get some (old) errors, and also errors accepted from the analysis which was not in pull request mode. Among the old issues, there are some files whicj has not been touched in the short-lived branch.
develop is a long-lived branch, and it has not issues when I analyze it.
If you’re using short-lived branch and pull request analysis, issues marked as false positive or accepted will retain that status after merge. This is the preferred approach.