We have found that after renaming a file and class in merge request all code is considered as new, however after merging to main only lines changed are really considered as new code.
This is causing the QG to pass for MR and fail for main branch.
I’m a little confused – how does this mean that the Quality Gate passes for the merge request but fails for the main branch if more code is considered new in the context of the merge request?
The reason why is that old code together with new (all code considered for MR) fulfill required coverage percentage, whereas new code alone doesn’t, hence failing for main branch.
e.g. file contains existing 90 lines with 100% coverage, 10 lines are added with 0% coverage.
MR: New code considered: 100 lines - Coverage on new code 90%
Main branch: New code considered: 10 lines - Coverage on new code 0%