The situation:
-
We have a nightly job that collects code coverage from the
master
/main
branch! -
At morning someone is merging PR to master with
86%
coverage (is means that some files will have low coverage, but generally it enough)
file1.tsx // 100%
file2.tsx // 90%
file3.tsx // 70%
// total: 86%
- Then other developer create a new PR
git history:
commit2 # morning merge (the PR with 86% coverage)
commit1 # nightly job used this commit to collect coverage
commitC
commitB
commitA
PROBLEM
-
if developer will use
commit1
as base for branch no issue, coverage for new files fill be correct ! -
BUT if he/she will use
commit2
then sonarqube fail and report:- that
file2.tsx
&file3.tsx
is a new files with low coverage, even I developer don’t touch them
- that
How fix this behavior ?