We’re seeing some very odd behaviour within SonarCloud where code duplication is increasing for every PR submitted for review.
In one PR that had a single character change in a single line of code, SonarCloud is reporting 32% code duplication on new lines of code. This is very confusing to the developers.
Template for a good new topic, formatted with Markdown:
ALM used: GitHub
CI system used: Jenkins (Linux Foundation - EdgeX Foundry)
Hi,
When this happens, could you send us the logs from the scanner, preferably with debug enabled?
It does look like the scanner is incorrectly collecting information about what was changed in the P/R from git.
The likely cause of these kind of issues is a problem with the git clone. It needs to not be a shallow clone and have up-to-date references to the base and master branches (‘tsconn23:issue_1816’ and ‘master’ in this case).
Thank you for your response @dmeneses. I checked the the Linux Foundation Release Engineers and since this is configured through SonarCloud against just the repo, I guess there’s no scans initiated on the LF infrastructure within Jenkins. I’m not sure how we’d enable verbose logging from SonarCloud. Is there an option to do that so I can work with LFRE?
It looks like we have a bug when scanning forked PR with Autoscan. We’re using the base branch of the forked repo instead of the base repo to compute new code.
That means for the PR your linked, new code is computed by comparing tsconn23:issue_1816 to tsconn23:master instead of edgexfoundry:master.
You can watch this ticket to track progress on this bug: SCCOMM-8.