- SonarQube version: 9.9.0-Developer
- Sonar Maven Plugin version: sonar-maven-plugin-3.9.1.2184
- Sonar is deployed as Docker
- Issue: Sonar scanner is not scanning changed files for PR scan even though there are multiple files in the PR.
- Attached screenshot of PR and the sonar scanner log from pipeline
sonar_pr_scan.log (443.3 KB)
Hey there.
What do you see in SonarQube? Specifically under the Code tab for this pull request (#150) in your project dashboard.
- What are the two analysis warnings referenced in the upper right?
- What’s in the Code tab?
- Based on your earlier screenshot where (in the file selected) only a line has been removed – is that the same across all 4 files changed (lines removed, not added)?
- Analysis warnings are same for all branches and PRs
- Code tab is empty
- PR has multiple line additions in other files.
Thanks.
Based on your screenshot it looks like this PR has been merged.
If this happens on another pull request, can you provide DEBUG
analysis logs (sonar-scanner -X
)?
Here is another PR log with debug options enabled. The analysis again did not have any new code, even though PR has multiple code additions
sonar_pr_scan.log (1.6 MB)
Hey there.
I noticed this line while reading through your logs:
[INFO] 16:02:19.966 Base dir: /harness
It sounded familiar, and then I remembered that some time ago, Harness acquired Drone, which we’ve heard about in this community before.
Do you use Drone with Harness?
That’s right. I have made the clone strategy for a PR to “Source branch” to avoid the merge issues. I’m now able to see the new code for a PR scan
Great! Thanks for letting us know. Is that a good long-term solution for you (I’ll be honest, I don’t know any others).
We will monitor if this setup is causing any issues when merging to target branch