Hello,
I’m using gitlab to scan my project under SonarQube instance.
The source and target branch have same code and same metrics under SonarQube New & Overall code metrics, However when I run a Merge request , the Pull Request in SonarQube is showing lower metrics.
Here is script for branch scan:
Hello,
Thanks for your reply, The code is fully covered only in the source and target branches New code with 100%, however in the overall code we have 70% for both branches .
I understood like the PR is considering all code as new code wich needs the overall code to get higher in the source and target branches as well in order to fit to clean as you code approach in the PR and get passed.
Assuming that proper SCM metadata is available to analysis, only the code that changed in the PR should be considered new code.
I’m a little confused here, but I suspect I’m not alone in that.
To Clean as You Code, you only need to make sure the code you check in today is clean and fully covered. Don’t worry about the overall code in the underlying branches. Making sure your new code is always good means your overall code will gradually improve, organically.
Hello,
In the source and target branches we have new and overall code metrics.
In the PR we don’t have metrics for new and overall code seperated , what we have is it a calculation and combination in same metrics of new and overall code ?
In source and target branch we have 100% coverage in new code analysis, however in PR we have less.
No this is legacy code which is considered overall code in source and target branches scan, this leads us to say that PR is considering overall and new code from source and target as New code in the PR.
I think that we need to increase the metrics in the source and target branches for overall code before proceeding the PR.