Skip to content

Commit bbb30e3

Browse files
committed
Changed default HTML extension from '*.htm' to '*.html'
1 parent 33a43a0 commit bbb30e3

11 files changed

+53
-19
lines changed

docs/resources/SampleReports.zip

4.33 KB
Binary file not shown.

src/AzureDevopsTask/ReportGenerator/reportgenerator.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@ async function executeReportGenerator(): Promise<number> {
2020
return await tool.exec();
2121
}
2222

23-
function copyHtmIndexToHtmlIndex() {
24-
var sourceFile = path.join(tl.getInput('targetdir'), 'index.htm');
25-
if (tl.exist(sourceFile)) {
26-
tl.cp(sourceFile, path.join(tl.getInput('targetdir'), 'index.html'), '-f');
27-
}
28-
}
29-
3023
async function run() {
3124
try {
3225
tl.setResourcePath(path.join( __dirname, 'task.json'));
@@ -37,8 +30,6 @@ async function run() {
3730
tl.setResult(tl.TaskResult.Failed, tl.loc('FailedMsg'));
3831
}
3932

40-
copyHtmIndexToHtmlIndex();
41-
4233
tl.setResult(tl.TaskResult.Succeeded, tl.loc('SucceedMsg'));
4334
} catch (e) {
4435
tl.debug(e.message);

src/Readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ CHANGELOG
6969
* New: #348: Added coverage indicator for methods/properties
7070
* New: #349: Apply query string to referenced CSS and JavaScript files and links to support SAS tokens (e.g. on blob storage)
7171
* New: Added Source Link for Nuget package 'ReportGenerator.Core'
72+
* New: Changed default HTML extension from '*.htm' to '*.html'
7273

7374
4.5.8.0
7475

src/ReportGenerator.Core/Reporting/Builders/HtmlChartReportBuilder.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.IO;
34
using System.Linq;
45
using Palmmedia.ReportGenerator.Core.CodeAnalysis;
56
using Palmmedia.ReportGenerator.Core.Parser.Analysis;
@@ -38,7 +39,7 @@ public override void CreateSummaryReport(IReportRenderer reportRenderer, Summary
3839
throw new ArgumentNullException(nameof(summaryResult));
3940
}
4041

41-
reportRenderer.BeginSummaryReport(this.ReportContext.ReportConfiguration.TargetDirectory, "CoverageHistory.htm", ReportResources.Summary);
42+
reportRenderer.BeginSummaryReport(this.ReportContext.ReportConfiguration.TargetDirectory, "CoverageHistory.html", ReportResources.Summary);
4243

4344
var historicCoverages = this.GetOverallHistoricCoverages(this.ReportContext.OverallHistoricCoverages);
4445
if (historicCoverages.Any(h => h.CoverageQuota.HasValue || h.BranchCoverageQuota.HasValue))
@@ -49,6 +50,11 @@ public override void CreateSummaryReport(IReportRenderer reportRenderer, Summary
4950
reportRenderer.CustomSummary(summaryResult.Assemblies, new List<RiskHotspot>(), summaryResult.SupportsBranchCoverage);
5051

5152
reportRenderer.SaveSummaryReport(this.ReportContext.ReportConfiguration.TargetDirectory);
53+
54+
File.Copy(
55+
Path.Combine(this.ReportContext.ReportConfiguration.TargetDirectory, "CoverageHistory.html"),
56+
Path.Combine(this.ReportContext.ReportConfiguration.TargetDirectory, "CoverageHistory.htm"),
57+
true);
5258
}
5359
}
5460
}

src/ReportGenerator.Core/Reporting/Builders/HtmlInlineAzurePipelinesDarkReportBuilder.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using System.IO;
23
using Palmmedia.ReportGenerator.Core.Parser.Analysis;
34
using Palmmedia.ReportGenerator.Core.Reporting.Builders.Rendering;
45

@@ -40,6 +41,11 @@ public override void CreateSummaryReport(SummaryResult summaryResult)
4041
{
4142
this.CreateSummaryReport(renderer, summaryResult);
4243
}
44+
45+
File.Copy(
46+
Path.Combine(this.ReportContext.ReportConfiguration.TargetDirectory, "index.html"),
47+
Path.Combine(this.ReportContext.ReportConfiguration.TargetDirectory, "index.htm"),
48+
true);
4349
}
4450
}
4551
}

src/ReportGenerator.Core/Reporting/Builders/HtmlInlineAzurePipelinesReportBuilder.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using System.IO;
23
using Palmmedia.ReportGenerator.Core.Parser.Analysis;
34
using Palmmedia.ReportGenerator.Core.Reporting.Builders.Rendering;
45

@@ -40,6 +41,11 @@ public override void CreateSummaryReport(SummaryResult summaryResult)
4041
{
4142
this.CreateSummaryReport(renderer, summaryResult);
4243
}
44+
45+
File.Copy(
46+
Path.Combine(this.ReportContext.ReportConfiguration.TargetDirectory, "index.html"),
47+
Path.Combine(this.ReportContext.ReportConfiguration.TargetDirectory, "index.htm"),
48+
true);
4349
}
4450
}
4551
}

src/ReportGenerator.Core/Reporting/Builders/HtmlInlineCssAndJavaScriptReportBuilder.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using System.IO;
23
using Palmmedia.ReportGenerator.Core.Parser.Analysis;
34
using Palmmedia.ReportGenerator.Core.Reporting.Builders.Rendering;
45

@@ -40,6 +41,11 @@ public override void CreateSummaryReport(SummaryResult summaryResult)
4041
{
4142
this.CreateSummaryReport(renderer, summaryResult);
4243
}
44+
45+
File.Copy(
46+
Path.Combine(this.ReportContext.ReportConfiguration.TargetDirectory, "index.html"),
47+
Path.Combine(this.ReportContext.ReportConfiguration.TargetDirectory, "index.htm"),
48+
true);
4349
}
4450
}
4551
}

src/ReportGenerator.Core/Reporting/Builders/HtmlReportBuilder.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using System.IO;
23
using Palmmedia.ReportGenerator.Core.Parser.Analysis;
34
using Palmmedia.ReportGenerator.Core.Reporting.Builders.Rendering;
45

@@ -64,6 +65,11 @@ public override void CreateSummaryReport(SummaryResult summaryResult)
6465
{
6566
this.CreateSummaryReport(renderer, summaryResult);
6667
}
68+
69+
File.Copy(
70+
Path.Combine(this.ReportContext.ReportConfiguration.TargetDirectory, "index.html"),
71+
Path.Combine(this.ReportContext.ReportConfiguration.TargetDirectory, "index.htm"),
72+
true);
6773
}
6874
}
6975
}

src/ReportGenerator.Core/Reporting/Builders/HtmlSummaryReportBuilder.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using System.IO;
23
using Palmmedia.ReportGenerator.Core.Parser.Analysis;
34
using Palmmedia.ReportGenerator.Core.Reporting.Builders.Rendering;
45

@@ -36,6 +37,16 @@ public override void CreateSummaryReport(SummaryResult summaryResult)
3637
{
3738
this.CreateSummaryReport(renderer, summaryResult);
3839
}
40+
41+
string sourcePath = Path.Combine(this.ReportContext.ReportConfiguration.TargetDirectory, "summary.html");
42+
43+
if (File.Exists(sourcePath))
44+
{
45+
File.Copy(
46+
sourcePath,
47+
Path.Combine(this.ReportContext.ReportConfiguration.TargetDirectory, "summary.htm"),
48+
true);
49+
}
3950
}
4051
}
4152
}

src/ReportGenerator.Core/Reporting/Builders/MhtmlReportBuilder.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,29 +146,30 @@ private void CreateMhtmlFile()
146146
writer.WriteLine("\tboundary=\"----=_NextPart_000_0000_01D23618.54EBCBE0\"");
147147
writer.WriteLine();
148148

149-
string file = "index.htm";
149+
string file = "index.html";
150150
string content = File.ReadAllText(Path.Combine(this.htmlReportTargetDirectory, file));
151151
content = AddFilePrefixForCssAndJavaScript(content);
152152
content = content.Replace("<tr><td><a href=\"", "<tr><td><a href=\"file:///");
153153
WriteFile(writer, file, "text/html", content);
154154

155-
foreach (var reportFile in Directory.EnumerateFiles(this.htmlReportTargetDirectory, "*.htm"))
155+
foreach (var reportFile in Directory.EnumerateFiles(this.htmlReportTargetDirectory, "*.html"))
156156
{
157-
if (reportFile.EndsWith("index.htm"))
157+
if (reportFile.EndsWith("index.html"))
158158
{
159159
continue;
160160
}
161161

162162
file = reportFile.Substring(reportFile.LastIndexOf(Path.DirectorySeparatorChar) + 1);
163163
content = File.ReadAllText(reportFile);
164164
content = AddFilePrefixForCssAndJavaScript(content);
165-
content = content.Replace("<a href=\"index.htm\">", "<a href=\"file:///index.htm\">");
165+
content = content.Replace("<a href=\"index.html\"", "<a href=\"file:///index.html\"");
166166
WriteFile(writer, file, "text/html", content);
167167
}
168168

169169
file = "main.js";
170170
content = File.ReadAllText(Path.Combine(this.htmlReportTargetDirectory, file));
171-
content = content.Replace(", \"reportPath\": \"", ", \"reportPath\" : \"file:///");
171+
content = content.Replace(", \"reportPath\": \"", ", \"reportPath\": \"file:///");
172+
content = content.Replace(", \"rp\": \"", ", \"rp\": \"file:///");
172173
WriteFile(writer, file, "application/javascript", content);
173174

174175
file = "class.js";

src/ReportGenerator.Core/Reporting/Builders/Rendering/HtmlRenderer.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ internal HtmlRenderer(bool onlySummary, HtmlMode htmlMode, string cssFileResourc
122122
/// <param name="title">The title.</param>
123123
public void BeginSummaryReport(string targetDirectory, string fileName, string title)
124124
{
125-
string targetPath = Path.Combine(targetDirectory, this.onlySummary ? "summary.htm" : "index.htm");
125+
string targetPath = Path.Combine(targetDirectory, this.onlySummary ? "summary.html" : "index.html");
126126

127127
if (fileName != null)
128128
{
@@ -198,7 +198,7 @@ public void HeaderWithGithubLinks(string text)
198198
/// <param name="text">The text.</param>
199199
public void HeaderWithBackLink(string text)
200200
{
201-
this.reportTextWriter.WriteLine("<h1><a href=\"index.htm\" class=\"back\">&lt;</a> {0}</h1>", WebUtility.HtmlEncode(text));
201+
this.reportTextWriter.WriteLine("<h1><a href=\"index.html\" class=\"back\">&lt;</a> {0}</h1>", WebUtility.HtmlEncode(text));
202202
}
203203

204204
/// <summary>
@@ -1270,7 +1270,7 @@ private static string GetClassReportFilename(string assemblyName, string classNa
12701270
}
12711271
}
12721272

1273-
fileName = StringHelper.ReplaceInvalidPathChars(assemblyName + "_" + shortClassName) + ".htm";
1273+
fileName = StringHelper.ReplaceInvalidPathChars(assemblyName + "_" + shortClassName) + ".html";
12741274

12751275
if (fileName.Length > 100)
12761276
{
@@ -1287,7 +1287,7 @@ private static string GetClassReportFilename(string assemblyName, string classNa
12871287

12881288
do
12891289
{
1290-
fileName = fileNameWithoutExtension + counter + ".htm";
1290+
fileName = fileNameWithoutExtension + counter + ".html";
12911291
counter++;
12921292
}
12931293
while (FileNameByClass.Values.Any(v => v.Equals(fileName, StringComparison.OrdinalIgnoreCase)));

0 commit comments

Comments
 (0)