Skip to content

Commit 12fb15f

Browse files
committed
pdepend - allow using coverage report for more precise stats
Closes #124
1 parent b3cd14e commit 12fb15f

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

.phpqa.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ php-cs-fixer:
2424
phpmd:
2525
standard: app/phpmd.xml
2626

27+
pdepend:
28+
coverageReport: build/coverage-clover.xml
29+
2730
phpcpd:
2831
minLines: 5
2932
minTokens: 70

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ Tool | Settings | Default Value | Your value
229229
[phpmetrics.git](https://github.com/EdgedesignCZ/phpqa/pull/122) | phpmetrics v2 analyses based on Git History | `null` | Boolean value or path to git binary
230230
[phpmetrics.junit](https://github.com/EdgedesignCZ/phpqa/pull/125) | phpmetrics v2 evaluates metrics according to JUnit logs | `null` | Path to JUnit xml
231231
[phpmetrics.composer](https://github.com/EdgedesignCZ/phpqa/pull/123) | phpmetrics v2 analyzes composer dependencies | `null` | Path to composer.json when the file is not included in `analyzedDirs`
232+
[pdepend.coverageReport](https://github.com/EdgedesignCZ/phpqa/pull/124) | Load Clover style CodeCoverage report | `null` | Path to report produced by PHPUnit's `--coverage-clover` option
232233
[phpmd](http://phpmd.org/documentation/creating-a-ruleset.html) | Ruleset | [Edgedesign's standard](/app/phpmd.xml) | Path to ruleset
233234
[phpcpd](https://github.com/sebastianbergmann/phpcpd/blob/de9056615da6c1230f3294384055fa7d722c38fa/src/CLI/Command.php#L136) | Minimum number of lines/tokens for copy-paste detection | 5 lines, 70 tokens |
234235
[phpstan](https://github.com/phpstan/phpstan#configuration) | Level, config file | Level 0, `%currentWorkingDirectory%/phpstan.neon` | Take a look at [phpqa config in tests/.travis](/tests/.travis/) |

src/Tools/Analyzer/Pdepend.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@ class Pdepend extends \Edge\QA\Tools\Tool
1212

1313
public function __invoke()
1414
{
15-
return array(
15+
$args = array(
1616
'jdepend-xml' => $this->options->toFile('pdepend-jdepend.xml'),
1717
'summary-xml' => $this->options->toFile('pdepend-summary.xml'),
1818
'dependency-xml' => $this->options->toFile('pdepend-dependencies.xml'),
1919
'jdepend-chart' => $this->options->toFile('pdepend-jdepend.svg'),
2020
'overview-pyramid' => $this->options->toFile('pdepend-pyramid.svg'),
2121
'suffix' => $this->config->csv('extensions'),
22-
$this->options->ignore->pdepend(),
23-
$this->options->getAnalyzedDirs(',')
22+
$this->options->ignore->pdepend()
2423
);
24+
$coverageReport = $this->config->value('pdepend.coverageReport');
25+
if ($coverageReport) {
26+
$args['coverage-report'] = $coverageReport;
27+
}
28+
$args[] = $this->options->getAnalyzedDirs(',');
29+
return $args;
2530
}
2631
}

tests/Config/ConfigTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function testLoadDefaultConfig()
3333
assertThat($config->value('phpmetrics.junit'), is(nullValue()));
3434
assertThat($config->value('phpmetrics.composer'), is(nullValue()));
3535
assertThat($config->value('phpmetrics.git'), identicalTo(false));
36+
assertThat($config->value('pdepend.coverageReport'), is(nullValue()));
3637
}
3738

3839
public function testBuildAbsolutePath()

0 commit comments

Comments
 (0)