- ALM used: GitHub
- CI system used: Jenkins
- Language: TypeScript
- Error observed:
When a new Pull Request is opened, SonarCloud is used to scan the PR and determine if there are any issues with the changed code.
“New Code” is defined in the project settings as comparing against the “previous version”.
However, the PR scan continually brings up pre-existing issues in the codebase, even when there are no changes to those lines.
Is there any way to scope the scan to only report on changed lines rather than the entire
.tsfile, which may contain unrelated code smells?
Welcome to the community!
Well, that’s what’s supposed to be happening.
Can you provide the analysis log for a PR where pre-existing issues were raised? And maybe also a screenshot of one of these issues? With both logs and screenshot redacted as necessary.
The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.
This guide will help you find them.
Thank you for the response!
I’m attaching the Sonar analysis log and a screenshot of the false positive (as well as the actual code change on a different line in the file).
SONAR_LOG.txt (44.9 KB)
Your two screenshots don’t seem to match each other; they’re from different parts of the file.
But the log tells the story:
INFO: SCM Publisher is disabled
Until you turn that back on, you won’t get accurate detection of new code.
Thanks for pointing me in the right direction - I found the configuration file where SCM publishing was turned off. I will test the solution and mark as resolved if it fixes our problem.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.