Skip to content

Commit e11a0c9

Browse files
authored
Merge pull request #30 from lucassabreu/fix/29
feat: only one package
2 parents caae140 + 7731da2 commit e11a0c9

File tree

7 files changed

+851
-7
lines changed

7 files changed

+851
-7
lines changed

.github/workflows/example.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,13 @@ jobs:
208208
table-below-coverage: 80
209209
only-with-coverable-lines: true
210210
signature: "clover file to comment - no lines after filter"
211+
212+
- name: clover file to comment - only one package
213+
uses: ./.
214+
with:
215+
dir-prefix: /var/www/html
216+
file: clover.onepackage.xml
217+
base-file: clover.onepackage.base.xml
218+
with-chart: true
219+
show-percentage-change-on-table: true
220+
signature: "clover file to comment - only one package"

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- when there was one package or file on a package the action failed to process the files
12+
913
## [0.9.1] - 2023-03-01
1014

1115
### Added

bin/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89426,9 +89426,12 @@ var Stats = /** @class */ (function () {
8942689426
return Stats;
8942789427
}());
8942889428

89429+
var asList = function (arg) {
89430+
return !!arg ? (Array.isArray(arg) ? arg : [arg]) : [];
89431+
};
8942989432
var fromString = function (str) {
8943089433
var _a = JSON.parse(lib.xml2json(str, { compact: true })).coverage.project, m = _a.metrics._attributes, files = _a.file, packages = _a.package;
89431-
var allFiles = (packages || []).reduce(function (acc, p) { return __spreadArray(__spreadArray([], acc, true), (Array.isArray(p.file) ? p.file : [p.file]), true); }, files || []);
89434+
var allFiles = asList(packages).reduce(function (acc, p) { return __spreadArray(__spreadArray([], acc, true), asList(p.file), true); }, asList(files));
8943289435
return new Stats({
8943389436
lines: new Coverage(m.statements, m.coveredstatements),
8943489437
methods: new Coverage(m.methods, m.coveredmethods),

bin/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clover.onepackage.base.xml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<coverage generated="1629064049">
3+
<project timestamp="1629064049">
4+
<package name="PHPMD">
5+
<file name="/var/www/html/src/main/php/PHPMD/AbstractNode.php">
6+
<class name="AbstractNode" namespace="PHPMD">
7+
<metrics complexity="32" methods="18" coveredmethods="13" conditionals="0" coveredconditionals="0" statements="49" coveredstatements="43" elements="67" coveredelements="56"/>
8+
</class>
9+
<line num="48" type="method" name="__construct" visibility="public" complexity="1" crap="1" count="95"/>
10+
<line num="50" type="stmt" count="95"/>
11+
<line num="63" type="method" name="__call" visibility="public" complexity="2" crap="2.26" count="45"/>
12+
<line num="65" type="stmt" count="45"/>
13+
<line num="66" type="stmt" count="45"/>
14+
<line num="67" type="stmt" count="0"/>
15+
<line num="68" type="stmt" count="0"/>
16+
<line num="72" type="stmt" count="45"/>
17+
<line num="81" type="method" name="getParent" visibility="public" complexity="2" crap="2.06" count="29"/>
18+
<line num="83" type="stmt" count="29"/>
19+
<line num="84" type="stmt" count="29"/>
20+
<line num="85" type="stmt" count="0"/>
21+
<line num="88" type="stmt" count="29"/>
22+
<line num="97" type="method" name="getChild" visibility="public" complexity="1" crap="1" count="23"/>
23+
<line num="99" type="stmt" count="23"/>
24+
<line num="100" type="stmt" count="23"/>
25+
<line num="101" type="stmt" count="23"/>
26+
<line num="112" type="method" name="getFirstChildOfType" visibility="public" complexity="2" crap="2.06" count="37"/>
27+
<line num="114" type="stmt" count="37"/>
28+
<line num="116" type="stmt" count="37"/>
29+
<line num="117" type="stmt" count="0"/>
30+
<line num="120" type="stmt" count="37"/>
31+
<line num="130" type="method" name="findChildrenOfType" visibility="public" complexity="2" crap="2" count="78"/>
32+
<line num="132" type="stmt" count="78"/>
33+
<line num="134" type="stmt" count="78"/>
34+
<line num="136" type="stmt" count="78"/>
35+
<line num="137" type="stmt" count="72"/>
36+
<line num="140" type="stmt" count="78"/>
37+
<line num="150" type="method" name="findChildrenWithParentType" visibility="public" complexity="3" crap="3" count="21"/>
38+
<line num="152" type="stmt" count="21"/>
39+
<line num="154" type="stmt" count="21"/>
40+
<line num="156" type="stmt" count="21"/>
41+
<line num="157" type="stmt" count="8"/>
42+
<line num="158" type="stmt" count="8"/>
43+
<line num="162" type="stmt" count="21"/>
44+
<line num="171" type="method" name="findChildrenOfTypeVariable" visibility="public" complexity="1" crap="1" count="23"/>
45+
<line num="173" type="stmt" count="23"/>
46+
<line num="182" type="method" name="isInstanceOf" visibility="public" complexity="1" crap="1" count="2"/>
47+
<line num="184" type="stmt" count="2"/>
48+
<line num="186" type="stmt" count="2"/>
49+
<line num="194" type="method" name="getImage" visibility="public" complexity="1" crap="1" count="4"/>
50+
<line num="196" type="stmt" count="4"/>
51+
<line num="205" type="method" name="getName" visibility="public" complexity="1" crap="1" count="28"/>
52+
<line num="207" type="stmt" count="28"/>
53+
<line num="215" type="method" name="getBeginLine" visibility="public" complexity="1" crap="1" count="16"/>
54+
<line num="217" type="stmt" count="16"/>
55+
<line num="225" type="method" name="getEndLine" visibility="public" complexity="1" crap="2" count="0"/>
56+
<line num="227" type="stmt" count="0"/>
57+
<line num="235" type="method" name="getFileName" visibility="public" complexity="3" crap="3" count="75"/>
58+
<line num="237" type="stmt" count="75"/>
59+
<line num="238" type="stmt" count="75"/>
60+
<line num="239" type="stmt" count="75"/>
61+
<line num="241" type="stmt" count="75"/>
62+
<line num="242" type="stmt" count="75"/>
63+
<line num="243" type="stmt" count="75"/>
64+
<line num="251" type="method" name="getNode" visibility="public" complexity="1" crap="1" count="72"/>
65+
<line num="253" type="stmt" count="72"/>
66+
<line num="261" type="method" name="getType" visibility="public" complexity="1" crap="1" count="3"/>
67+
<line num="263" type="stmt" count="3"/>
68+
<line num="265" type="stmt" count="3"/>
69+
<line num="275" type="method" name="getMetric" visibility="public" complexity="2" crap="2.15" count="3"/>
70+
<line num="277" type="stmt" count="3"/>
71+
<line num="278" type="stmt" count="3"/>
72+
<line num="281" type="stmt" count="0"/>
73+
<line num="290" type="method" name="setMetrics" visibility="public" complexity="2" crap="2" count="6"/>
74+
<line num="292" type="stmt" count="6"/>
75+
<line num="293" type="stmt" count="6"/>
76+
<metrics loc="328" ncloc="166" classes="1" methods="18" coveredmethods="13" conditionals="0" coveredconditionals="0" statements="49" coveredstatements="43" elements="67" coveredelements="56"/>
77+
</file>
78+
</package>
79+
<metrics files="101" loc="11932" ncloc="6615" classes="91" methods="437" coveredmethods="354" conditionals="0" coveredconditionals="0" statements="2156" coveredstatements="1898" elements="2593" coveredelements="2252"/>
80+
</project>
81+
</coverage>

0 commit comments

Comments
 (0)