Skip to content

Commit

Permalink
#433: Added report types Html_Light, Html_Dark and HtmlInline_AzurePi…
Browse files Browse the repository at this point in the history
…pelines_Light
  • Loading branch information
danielpalme committed Feb 9, 2022
1 parent 6cdc048 commit 27fe53a
Show file tree
Hide file tree
Showing 17 changed files with 794 additions and 323 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ Explanations:
Globbing is supported.
Target directory: The directory where the generated report should be saved.
Report types: The output formats and scope (separated by semicolon).
Values: Badges, Clover, Cobertura, CsvSummary, MarkdownSummary, Html, HtmlChart, HtmlInline,
HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlSummary,
Values: Badges, Clover, Cobertura, CsvSummary, MarkdownSummary,
Html, Html_Light, Html_Dark,
HtmlChart, HtmlInline, HtmlSummary,
HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Light, HtmlInline_AzurePipelines_Dark,
JsonSummary, Latex, LatexSummary, lcov, MHtml, PngChart, SonarQube, TeamCitySummary,
TextSummary, Xml, XmlSummary
Source directories: Optional directories which contain the corresponding source code (separated by semicolon).
Expand Down Expand Up @@ -201,7 +203,7 @@ If you need a custom format, you can create a [plugin](https://github.com/daniel

| **Input formats** | **Output formats** |
|:------------------|:-------------------|
| <ul><li>[OpenCover](https://github.com/OpenCover/opencover) ([Nuget](https://www.nuget.org/packages/OpenCover))<br/>OpenCover format is also generated by [coverlet](https://github.com/coverlet-coverage/coverlet/) and [altcover](https://github.com/SteveGilham/altcover)</li><li>[dotCover](https://www.jetbrains.com/dotcover/help/dotCover__Console_Runner_Commands.html) ([Nuget](https://www.nuget.org/packages/JetBrains.dotCover.CommandLineTools/), /ReportType=DetailedXML)</li><li>Visual Studio ([vstest.console.exe](https://github.com/danielpalme/ReportGenerator/wiki/Visual-Studio-Coverage-Tools#vstestconsoleexe), [CodeCoverage.exe](https://github.com/danielpalme/ReportGenerator/wiki/Visual-Studio-Coverage-Tools#codecoverageexe))</li><li>[NCover](https://www.ncover.com/info/download) (tested version 1.5.8, other versions may not work)</li><li>[Cobertura](https://github.com/cobertura/cobertura)</li><li>[JaCoCo](https://www.jacoco.org/jacoco/index.html)</li><li>[Clover](https://openclover.org/)</li><li>Mono ([mprof-report](https://www.mono-project.com/docs/debug+profile/profile/profiler/#analyzing-the-profile-data))</li><li>[gcov](https://gcc.gnu.org/onlinedocs/gcc/Gcov.html)</li><li>[lcov](https://github.com/linux-test-project/lcov)</li></ul><br/> | <ul><li>Html, HtmlSummary, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlChart, [MHtml](https://en.wikipedia.org/wiki/MHTML)</li><li>Clover</li><li>Cobertura</li><li>[SonarQube](https://docs.sonarqube.org/latest/analysis/generic-test)</li><li>TeamCitySummary</li><li>[lcov](https://github.com/linux-test-project/lcov)</li><li>Xml, XmlSummary</li><li>JsonSummary</li><li>Latex, LatexSummary</li><li>TextSummary</li><li>CsvSummary</li><li>MarkdownSummary</li><li>PngChart</li><li>Badges</li><li>[Custom reports](https://github.com/danielpalme/ReportGenerator/wiki/Custom-reports)</li></ul> |
| <ul><li>[OpenCover](https://github.com/OpenCover/opencover) ([Nuget](https://www.nuget.org/packages/OpenCover))<br/>OpenCover format is also generated by [coverlet](https://github.com/coverlet-coverage/coverlet/) and [altcover](https://github.com/SteveGilham/altcover)</li><li>[dotCover](https://www.jetbrains.com/dotcover/help/dotCover__Console_Runner_Commands.html) ([Nuget](https://www.nuget.org/packages/JetBrains.dotCover.CommandLineTools/), /ReportType=DetailedXML)</li><li>Visual Studio ([vstest.console.exe](https://github.com/danielpalme/ReportGenerator/wiki/Visual-Studio-Coverage-Tools#vstestconsoleexe), [CodeCoverage.exe](https://github.com/danielpalme/ReportGenerator/wiki/Visual-Studio-Coverage-Tools#codecoverageexe))</li><li>[NCover](https://www.ncover.com/info/download) (tested version 1.5.8, other versions may not work)</li><li>[Cobertura](https://github.com/cobertura/cobertura)</li><li>[JaCoCo](https://www.jacoco.org/jacoco/index.html)</li><li>[Clover](https://openclover.org/)</li><li>Mono ([mprof-report](https://www.mono-project.com/docs/debug+profile/profile/profiler/#analyzing-the-profile-data))</li><li>[gcov](https://gcc.gnu.org/onlinedocs/gcc/Gcov.html)</li><li>[lcov](https://github.com/linux-test-project/lcov)</li></ul><br/> | <ul><li>Html, Html_Light, Html_Dark, HtmlSummary, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Light, HtmlInline_AzurePipelines_Dark, [MHtml](https://en.wikipedia.org/wiki/MHTML)</li><li>Clover</li><li>Cobertura</li><li>[SonarQube](https://docs.sonarqube.org/latest/analysis/generic-test)</li><li>TeamCitySummary</li><li>[lcov](https://github.com/linux-test-project/lcov)</li><li>Xml, XmlSummary</li><li>JsonSummary</li><li>Latex, LatexSummary</li><li>TextSummary</li><li>CsvSummary</li><li>MarkdownSummary</li><li>PngChart</li><li>Badges</li><li>[Custom reports](https://github.com/danielpalme/ReportGenerator/wiki/Custom-reports)</li></ul> |

### Screenshots
The screenshots show two snippets of the generated reports:
Expand Down
9 changes: 6 additions & 3 deletions docs/usage.html
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,14 @@ <h4>Usage</h4>
$scope.targetdir = 'coveragereport';
$scope.reporttypes = [
{ name: 'Html', description: 'The default output format. Creates a summary overview (index.htm) and detailed reports for each class.', requiresHistoryDir: false, checked: true },
{ name: 'Html_Light', description: 'Same as Html but with a light theme.', requiresHistoryDir: false, checked: false },
{ name: 'Html_Dark', description: 'Same as Html but with a dark theme.', requiresHistoryDir: false, checked: false },
{ name: 'HtmlSummary', description: 'Creates a single HTML file (summary.htm) without links.', requiresHistoryDir: false, checked: false },
{ name: 'HtmlInline', description: 'Same as HTML but CSS and JavaScript is included in every HTML page. This results in larger file sizes, but can be useful for integration into build servers like Azure DevOps (VSTS), since they may block referenced CSS and JavaScript files.', requiresHistoryDir: false, checked: false },
{ name: 'HtmlInline_AzurePipelines', description: 'Same as HTMLInline but with modified CSS that matches the light look and feel of Azure Pipelines.', requiresHistoryDir: false, checked: false },
{ name: 'HtmlInline_AzurePipelines_Dark', description: 'Same as HTMLInline but with modified CSS that matches the dark look and feel of Azure Pipelines.', requiresHistoryDir: false, checked: false },
{ name: 'HtmlChart', description: 'Creates a single HTML file containing a chart with historic coverage information.', requiresHistoryDir: true, checked: false },
{ name: 'HtmlInline', description: 'Same as HTML but CSS and JavaScript is included in every HTML page. This results in larger file sizes, but can be useful for integration into build servers like Azure DevOps (VSTS), since they may block referenced CSS and JavaScript files.', requiresHistoryDir: false, checked: false },
{ name: 'HtmlInline_AzurePipelines', description: 'Same as HtmlInline but with an adpative light/dark theme matching the light look and feel of Azure Pipelines.', requiresHistoryDir: false, checked: false },
{ name: 'HtmlInline_AzurePipelines_Light', description: 'Same as HtmlInline but with a light theme matching the light look and feel of Azure Pipelines.', requiresHistoryDir: false, checked: false },
{ name: 'HtmlInline_AzurePipelines_Dark', description: 'Same as HtmlInline but with a dark theme matching the dark look and feel of Azure Pipelines.', requiresHistoryDir: false, checked: false },
{ name: 'MHtml', description: 'Same as HTML but packaged into a single MHTML file.', requiresHistoryDir: false, checked: false },
{ name: 'Clover', description: 'Creates a XML file in Clover format. This format integrates with tools like Atlassian Bamboo.', requiresHistoryDir: false, checked: false },
{ name: 'Cobertura', description: 'Creates a XML file in Cobertura format. This format integrates with tools like Azure DevOps (VSTS) or Jenkins.', requiresHistoryDir: false, checked: false },
Expand Down
2 changes: 1 addition & 1 deletion src/AzureDevopsTask/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To learn how to use *ReportGenerator* have a look at the:
inputs:
reports: 'coverage.xml' # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported.
targetdir: 'coveragereport' # REQUIRED # The directory where the generated report should be saved.
reporttypes: 'HtmlInline_AzurePipelines;Cobertura' # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MarkdownSummary, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary
reporttypes: 'HtmlInline_AzurePipelines;Cobertura' # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, Html_Dark, Html_Light, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlInline_AzurePipelines_Light, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MarkdownSummary, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary
sourcedirs: '' # Optional directories which contain the corresponding source code (separated by semicolon). The source directories are used if coverage report contains classes without path information.
historydir: '' # Optional directory for storing persistent coverage information. Can be used in future reports to show coverage evolution.
plugins: '' # Optional plugin files for custom reports or custom history storage (separated by semicolon).
Expand Down
2 changes: 1 addition & 1 deletion src/AzureDevopsTask/ReportGenerator/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"label": "Report types",
"defaultValue": "HtmlInline_AzurePipelines;Cobertura",
"required": false,
"helpMarkDown": "The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MarkdownSummary, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary"
"helpMarkDown": "The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, Html_Dark, Html_Light, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlInline_AzurePipelines_Light, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MarkdownSummary, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary"
},
{
"name": "sourcedirs",
Expand Down
11 changes: 10 additions & 1 deletion src/Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ ReportGenerator supports merging several reports into one.

The following output formats are supported by ReportGenerator:

-Html, HtmlSummary, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlChart, MHtml
-Html, Html_Light, Html_Dark
-HtmlSummary, HtmlChart, HtmlInline
-HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Light, HtmlInline_AzurePipelines_Dark
-MHtml
-Clover
-Cobertura
-SonarQube
Expand Down Expand Up @@ -64,6 +67,12 @@ For further details take a look at LICENSE.txt.

CHANGELOG

5.1.0.0

* New: #433: Added report types Html_Light, Html_Dark and HtmlInline_AzurePipelines_Light
* New: HTML reports: Replaced tabular data with cards
* New: Added method coverage to summary table

5.0.4.0

* Fix: #482: Fixed incorrect shadow text in badges
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"ReportGenerator.Console.NetCore": {
"commandName": "Project",
"commandLineArgs": "-reports:C:\\Users\\danie\\Documents\\Projects\\ReportGenerator\\src\\Testprojects\\CSharp\\Reports\\OpenCover.xml -targetdir:out"
"commandLineArgs": "-reports:C:\\Users\\danie\\Documents\\Projects\\ReportGenerator\\src\\Testprojects\\CSharp\\Reports\\OpenCover.xml -targetdir:C:\\Users\\danie\\Desktop\\test -historydir:C:\\Users\\danie\\Desktop\\test\\history -title:TestTitle -tag:TestTag -reportTypes:Html;HtmlChart;Latex;HtmlInline_AzurePipelines_Dark;HtmlInline_AzurePipelines --settings:createSubdirectoryForAllReportTypes=true"
}
}
}
6 changes: 6 additions & 0 deletions src/ReportGenerator.Core/ReportGenerator.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
<ItemGroup>
<None Remove="Reporting\Builders\Rendering\resources\chartist.min.css" />
<None Remove="Reporting\Builders\Rendering\resources\chartist.min.js" />
<None Remove="Reporting\Builders\Rendering\resources\custom-azurepipelines_adaptive.css" />
<None Remove="Reporting\Builders\Rendering\resources\custom-azurepipelines_dark.css" />
<None Remove="Reporting\Builders\Rendering\resources\custom.css" />
<None Remove="Reporting\Builders\Rendering\resources\custom-azurepipelines.css" />
<None Remove="Reporting\Builders\Rendering\resources\custom.js" />
<None Remove="Reporting\Builders\Rendering\resources\custom_adaptive.css" />
<None Remove="Reporting\Builders\Rendering\resources\custom_dark.css" />
<None Remove="Reporting\Builders\Rendering\resources\main.js" />
<None Remove="Reporting\Builders\Rendering\resources\polyfills.js" />
<None Remove="Reporting\Builders\Rendering\resources\runtime.js" />
Expand All @@ -30,6 +33,9 @@
<ItemGroup>
<EmbeddedResource Include="Reporting\Builders\Rendering\resources\chartist.min.css" />
<EmbeddedResource Include="Reporting\Builders\Rendering\resources\chartist.min.js" />
<EmbeddedResource Include="Reporting\Builders\Rendering\resources\custom_dark.css" />
<EmbeddedResource Include="Reporting\Builders\Rendering\resources\custom_adaptive.css" />
<EmbeddedResource Include="Reporting\Builders\Rendering\resources\custom-azurepipelines_adaptive.css" />
<EmbeddedResource Include="Reporting\Builders\Rendering\resources\custom-azurepipelines_dark.css" />
<EmbeddedResource Include="Reporting\Builders\Rendering\resources\custom.css" />
<EmbeddedResource Include="Reporting\Builders\Rendering\resources\custom-azurepipelines.css" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using System.Collections.Generic;
using System.IO;
using Palmmedia.ReportGenerator.Core.Parser.Analysis;
using Palmmedia.ReportGenerator.Core.Reporting.Builders.Rendering;

namespace Palmmedia.ReportGenerator.Core.Reporting.Builders
{
/// <summary>
/// Creates report in HTML format.
/// </summary>
public class HtmlDarkReportBuilder : HtmlReportBuilderBase
{
/// <summary>
/// Defines how CSS and JavaScript are referenced.
/// </summary>
private readonly HtmlMode htmlMode;

/// <summary>
/// Dictionary containing the filenames of the class reports by class.
/// </summary>
private readonly IDictionary<string, string> fileNameByClass = new Dictionary<string, string>();

/// <summary>
/// Initializes a new instance of the <see cref="HtmlDarkReportBuilder" /> class.
/// </summary>
public HtmlDarkReportBuilder()
: this(true)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="HtmlDarkReportBuilder" /> class.
/// </summary>
/// <param name="externalCssAndJavaScriptWithQueryStringHandling">Defines how CSS and JavaScript are referenced.</param>
public HtmlDarkReportBuilder(bool externalCssAndJavaScriptWithQueryStringHandling)
{
this.htmlMode = externalCssAndJavaScriptWithQueryStringHandling ? HtmlMode.ExternalCssAndJavaScriptWithQueryStringHandling
: HtmlMode.ExternalCssAndJavaScript;
}

/// <summary>
/// Gets the report type.
/// </summary>
/// <value>
/// The report format.
/// </value>
public override string ReportType => "Html_Dark";

/// <summary>
/// Creates a class report.
/// </summary>
/// <param name="class">The class.</param>
/// <param name="fileAnalyses">The file analyses that correspond to the class.</param>
public override void CreateClassReport(Class @class, IEnumerable<FileAnalysis> fileAnalyses)
{
using (var renderer = new HtmlRenderer(this.fileNameByClass, false, this.htmlMode, "custom.css", "custom_dark.css"))
{
this.CreateClassReport(renderer, @class, fileAnalyses);
}
}

/// <summary>
/// Creates the summary report.
/// </summary>
/// <param name="summaryResult">The summary result.</param>
public override void CreateSummaryReport(SummaryResult summaryResult)
{
using (var renderer = new HtmlRenderer(this.fileNameByClass, false, this.htmlMode, "custom.css", "custom_dark.css"))
{
this.CreateSummaryReport(renderer, summaryResult);
}

string targetDirectory = this.CreateTargetDirectory();

File.Copy(
Path.Combine(targetDirectory, "index.html"),
Path.Combine(targetDirectory, "index.htm"),
true);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System.Collections.Generic;
using System.IO;
using Palmmedia.ReportGenerator.Core.Parser.Analysis;
using Palmmedia.ReportGenerator.Core.Reporting.Builders.Rendering;

namespace Palmmedia.ReportGenerator.Core.Reporting.Builders
{
/// <summary>
/// Creates report in HTML format.
/// </summary>
public class HtmlInlineAzurePipelinesLightReportBuilder : HtmlReportBuilderBase
{
/// <summary>
/// Dictionary containing the filenames of the class reports by class.
/// </summary>
private readonly IDictionary<string, string> fileNameByClass = new Dictionary<string, string>();

/// <summary>
/// Gets the report type.
/// </summary>
/// <value>
/// The report format.
/// </value>
public override string ReportType => "HtmlInline_AzurePipelines_Light";

/// <summary>
/// Creates a class report.
/// </summary>
/// <param name="class">The class.</param>
/// <param name="fileAnalyses">The file analyses that correspond to the class.</param>
public override void CreateClassReport(Class @class, IEnumerable<FileAnalysis> fileAnalyses)
{
using (var renderer = new HtmlRenderer(this.fileNameByClass, false, HtmlMode.InlineCssAndJavaScript, "custom-azurepipelines.css", null))
{
this.CreateClassReport(renderer, @class, fileAnalyses);
}
}

/// <summary>
/// Creates the summary report.
/// </summary>
/// <param name="summaryResult">The summary result.</param>
public override void CreateSummaryReport(SummaryResult summaryResult)
{
using (var renderer = new HtmlRenderer(this.fileNameByClass, false, HtmlMode.InlineCssAndJavaScript, "custom-azurepipelines.css", null))
{
this.CreateSummaryReport(renderer, summaryResult);
}

string targetDirectory = this.CreateTargetDirectory();

File.Copy(
Path.Combine(targetDirectory, "index.html"),
Path.Combine(targetDirectory, "index.htm"),
true);
}
}
}

0 comments on commit 27fe53a

Please sign in to comment.