Skip to content

Commit 1a6b13f

Browse files
committed
Significantly improve merge performance and fix false uncovered lines
Do not process uncovered files from whitelist while merging several php-coverage dumps and do it only when generating a report. This also fixes false positive uncovered lines (like single curly brace on a line) for files which are not covered in each php-coverage dump. Speedup when merging 38 php-coverage dumps is: php report: 5m15.743s -> 0m1.844s = 171x html report: 5m57.710s -> 0m23.524s = 15x
1 parent 9ef4b8c commit 1a6b13f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/CodeCoverage.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public function append(array $data, $id = null, $append = true, $linesToBeCovere
349349
*/
350350
public function merge(PHP_CodeCoverage $that)
351351
{
352-
foreach ($that->getData() as $file => $lines) {
352+
foreach ($that->getData(true) as $file => $lines) {
353353
if (!isset($this->data[$file])) {
354354
if (!$that->filter()->isFiltered($file)) {
355355
$this->data[$file] = $lines;
@@ -372,6 +372,8 @@ public function merge(PHP_CodeCoverage $that)
372372
}
373373

374374
$this->tests = array_merge($this->tests, $that->getTests());
375+
$this->filter->addFilesToBlacklist(array_keys($that->filter()->getBlacklistedFiles()));
376+
$this->filter->addFilesToWhitelist(array_keys($that->filter()->getWhitelistedFiles()));
375377
}
376378

377379
/**

0 commit comments

Comments
 (0)