If we consider the default built-in quality gate, developers currently miss the coverage and duplication information when they're working on short-living branches and pull requests. They also miss this info in their IDE when working using SonarLint.
They want to be sure that they can safely merge, and for this computing (at least) those 2 measures would definitely help.
Coverage and duplication info for short-lived branches / PRs can be expressed in different ways:
- the measures computed on the code that was added/modified with the short-lived branch / the PR
- the overall measures computed:
- either on the feature branch
- or, depending on the way the Continuous Integration engine builds the PR, on the merge of the PR with the target branch
But, in all cases, the goal is is the same: being able to know if the quality of the code is good enough to be merged.
Ultimately, we would also expect the status of the short-lived branch / PR to directly show whether the new code can be merged or not.
This MMF will first focus on computing and displaying the coverage. Some other MMFs will deal with duplication and short-lived / PR status.
As a developer, I want to see the 2 kind of information for my short-lived branch / PR:
- the coverage on the new/updated lines of code
- the overall approximate coverage of the merge
this overall coverage will be computed on the source branch or on the merge with the target branch, depending on the CI I work with and thus depending on what I'm used to.
Ex: 90% of the new code is covered / approximately 80% of the whole code is covered
Close to the number of bugs, vulnerabilities and code smells, the header will display:
- coverage on new code - tooltip: Coverage on New Code. See Measures for details.
- overall coverage - tooltip: Estimated Overall Coverage after merge.
A tooltip will explain that the overall coverage value can be considered an approximation of the coverage on the target branch if the branch / PR is merged.
A measures page, similar to one displayed for long-lived branches, will allow you to see the New Code coverage metrics.
List and tree views will be available, but not treemap nor history since only the files that were changed can be seen there.
No other measure / overall graphs will be displayed for now.
- In addition to the metrics already displayed, the code page will show the % coverage. Metrics should be shown in the same order, left-to-right, as on the Code page for long-lived branches.
- "Lines of code" on this page currently refers to the total number of lines of code for each folder / file. This will be changed into the number of new/updated lines of code.
- It will be also more clear that the other metrics (bugs, vulnerabilities, code smells) also correspond to measures computed "on new code".
We'll include coverage data in the PR summary comment for:
We'll update the current status slightly. With issues:
x Bugs, y Vulnerabilities, z Code Smells; n% New Code Coverage, m% Est. post-merge Coverage
No issues; n% New Code Coverage, m% Est. post-merge Coverage