Skip to content

Commit 3e83d9c

Browse files
committed
#578: Improved support for Clover files generated by PhpUnit
1 parent d7fb34f commit 3e83d9c

File tree

6 files changed

+21
-5
lines changed

6 files changed

+21
-5
lines changed

src/AngularComponents/src/app/components/coverageinfo/coverage-info.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export class CoverageInfoComponent {
233233
for (let j: number = 0; j < assemblies[i].classes.length; j++) {
234234
groupingMaximum = Math.max(
235235
groupingMaximum,
236-
(assemblies[i].classes[j].name.match(/\./g) || []).length);
236+
(assemblies[i].classes[j].name.match(/\.|\\/g) || []).length);
237237
}
238238
}
239239

@@ -244,7 +244,7 @@ export class CoverageInfoComponent {
244244
const startOfQueryString: number = window.location.href.indexOf("?");
245245

246246
if (startOfQueryString > -1) {
247-
this.queryString = window.location.href.substr(startOfQueryString);
247+
this.queryString = window.location.href.substring(startOfQueryString);
248248
}
249249

250250
this.updateCoverageInfo();

src/AngularComponents/src/app/components/coverageinfo/viewmodels/codelement-viewmodel.class.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ export class CodeElementViewModel extends ElementBase {
5555
}
5656

5757
let groupingDotIndex: number = Helper.getNthOrLastIndexOf(clazz.name, ".", grouping);
58-
let groupedNamespace: string = groupingDotIndex === -1 ? "-" : clazz.name.substr(0, groupingDotIndex);
58+
59+
if (groupingDotIndex === -1) {
60+
groupingDotIndex = Helper.getNthOrLastIndexOf(clazz.name, "\\", grouping);
61+
}
62+
63+
let groupedNamespace: string = groupingDotIndex === -1 ? "-" : clazz.name.substring(0, groupingDotIndex);
5964

6065
for (let i: number = 0; i < this.subElements.length; i++) {
6166
if (this.subElements[i].name === groupedNamespace) {

src/AngularComponents/src/app/components/riskhotspots/riskhotspots.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export class RiskHotspotsComponent implements OnInit {
117117
const startOfQueryString: number = window.location.href.indexOf("?");
118118

119119
if (startOfQueryString > -1) {
120-
this.queryString = window.location.href.substr(startOfQueryString);
120+
this.queryString = window.location.href.substring(startOfQueryString);
121121
}
122122

123123
this.updateRiskHotpots();

src/Readme.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ For further details take a look at LICENSE.txt.
6767

6868
CHANGELOG
6969

70+
5.1.14.0
71+
72+
* New: #578: Improved support for Clover files generated by PhpUnit
73+
7074
5.1.13.0
7175

7276
* New: #567: Added report type: MarkdownSummaryGithub

src/ReportGenerator.Core/Parser/Preprocessing/CloverReportPreprocessor.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ internal void Execute(XContainer report)
8989
{
9090
file.Add(new XAttribute("path", nameAttribute.Value));
9191
}
92+
93+
var @class = file.Element("class");
94+
95+
if (@class != null && @class.Attribute("namespace")?.Value == "global")
96+
{
97+
file.Attribute("name").Value = @class.Attribute("name").Value;
98+
}
9299
}
93100

94101
if (this.sourceDirectories.Count == 0)

src/ReportGenerator.Core/Reporting/Builders/Rendering/resources/main.js

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

0 commit comments

Comments
 (0)