Skip to content

Commit

Permalink
#426: Added file numbers to class report
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpalme committed Jun 20, 2021
2 parents 241db67 + 3f6fb3a commit f1171ac
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/Readme.txt
Expand Up @@ -64,6 +64,10 @@ For further details take a look at LICENSE.txt.

CHANGELOG

4.8.11.0

* New: #426: Added file numbers to class report

4.8.10.0

* New: #431: Added Markdown output format
Expand Down
11 changes: 10 additions & 1 deletion src/ReportGenerator.Core/Properties/ReportResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/ReportGenerator.Core/Properties/ReportResources.resx
Expand Up @@ -345,4 +345,7 @@
<data name="StarTooltip" xml:space="preserve">
<value>Star on GitHub</value>
</data>
<data name="File" xml:space="preserve">
<value>File</value>
</data>
</root>
Expand Up @@ -298,7 +298,7 @@ public void TestMethods(IEnumerable<TestMethod> testMethods, IEnumerable<FileAna
item.Key,
codeElement.FirstLine,
codeElement.CoverageQuota.HasValue ? coverageRounded.ToString() : "undefined",
codeElement.CoverageQuota.HasValue ? ReportResources.Coverage2 + " " + codeElement.CoverageQuota.Value.ToString(CultureInfo.InvariantCulture) + "% - " : string.Empty,
$"{ReportResources.File} {item.Key + 1}: " + (codeElement.CoverageQuota.HasValue ? ReportResources.Coverage2 + " " + codeElement.CoverageQuota.Value.ToString(CultureInfo.InvariantCulture) + "% - " : string.Empty),
WebUtility.HtmlEncode(codeElement.Name),
codeElement.CodeElementType == CodeElementType.Method ? "cube" : "wrench");
}
Expand Down Expand Up @@ -626,7 +626,8 @@ public void KeyValueRow(string key, string value)
/// <param name="files">The files.</param>
public void KeyValueRow(string key, IEnumerable<string> files)
{
string value = string.Join("<br />", files.Select(v => string.Format(CultureInfo.InvariantCulture, "<a href=\"#{0}\" class=\"navigatetohash\">{1}</a>", WebUtility.HtmlEncode(StringHelper.ReplaceNonLetterChars(v)), WebUtility.HtmlEncode(v))));
int fileNumber = 1;
string value = string.Join("<br />", files.Select(v => string.Format(CultureInfo.InvariantCulture, "<a href=\"#{0}\" class=\"navigatetohash\">{1}</a>", WebUtility.HtmlEncode(StringHelper.ReplaceNonLetterChars(v)), WebUtility.HtmlEncode($"{ReportResources.File} {fileNumber++}: " + v))));

this.reportTextWriter.WriteLine(
"<tr><th>{0}</th><td>{1}</td></tr>",
Expand Down Expand Up @@ -686,11 +687,11 @@ public void MetricsTable(Class @class)
WebUtility.HtmlEncode(methodMetric.FullName),
fileIndex,
methodMetric.Line,
WebUtility.HtmlEncode(methodMetric.ShortName));
WebUtility.HtmlEncode($"{ReportResources.File} {fileIndex + 1}: " + methodMetric.ShortName));
}
else
{
this.reportTextWriter.Write("<td title=\"{0}\">{1}</td>", WebUtility.HtmlEncode(methodMetric.FullName), WebUtility.HtmlEncode(methodMetric.ShortName));
this.reportTextWriter.Write("<td title=\"{0}\">{1}</td>", WebUtility.HtmlEncode(methodMetric.FullName), WebUtility.HtmlEncode(file.Path + " => " + methodMetric.ShortName));
}

foreach (var metric in metrics)
Expand Down

0 comments on commit f1171ac

Please sign in to comment.