Write coverage in the generic test data XML format read by SonarQube.
sonarqube(x, file = "sonarqube.xml", path_prefix = NULL)The XML document (an xml2 document), invisibly, after writing it
to file.
the coverage object returned from package_coverage()
the name of the SonarQube Generic XML file
SonarQube expects file paths relative to the project's
base directory. By default the paths are relative to the package root
(e.g. R/foo.R), which is correct when the package is the root of the
SonarQube project. If the package is in a subdirectory of the project,
set path_prefix to that subdirectory (e.g. "pkg" gives pkg/R/foo.R).
Talkdesk Inc.
Every line with coverage is reported as a lineToCover with its lineNumber
and whether it is covered, including the lines of compiled code. Each line
is reported once: when several functions share a line, it is only covered if
all its code was run, as in report() and percent_coverage().
Branches are only reported if they were measured with
options(covr.branch_coverage = TRUE) (see covr.branch_coverage). A line
where an if or switch() starts then also has branchesToCover, the
number of branches of the if and switch() calls on the line, and
coveredBranches, how many of them were taken.
This functionality requires the xml2 package be installed.