How danielpalme/reportgenerator works
Project Type and Purpose
• ReportGenerator is a code coverage report converter and visualizer. It accepts input formats from multiple coverage tools (e.g., Coverlet, OpenCover, dotCover, JaCoCo, etc.) and converts them into human-readable reports – mostly in HTML and similar formats. It also supports merging and processing legacy or advanced reports (badges, charts, risk hotspot analysis, etc.).
• The tool is used as a command-line utility, a global .NET tool, and even as an MSBuild task. It additionally provides an Angular-based front-end for rich interactive reporting.
Main Components
a. Input/Integration Layer:
– Coverage Report Input: Files from various formats (XML, JSON, etc.)
– Plug-ins and custom report providers (plug-in architecture allowing external extension points)
– Integration points: MSBuild task, Dotnet global tool invocation, and Azure DevOps (as seen in separate directories for AzureDevopsTask and its test project)
– .netconfig support for persistent settings
b. Core Processing Layer (ReportGenerator.Core):
– Parser Module: Contains various parser implementations (e.g., OpenCoverParser, JaCoCoParser, CoberturaParser, etc.) that read and transform raw coverage data.
– Preprocessing/Filtering: Supports filtering (assembly, class, file filters) with corresponding modules.
– Reporting Engine & Report Builder: Uses builder implementations (HTML, Markdown, Latex, etc.) to generate the final data output. Multiple builder submodules (e.g., HtmlReportBuilder, LatexReportBuilder, etc.) fall under this component.
– Risk Hotspots Analysis: Specialized modules for assessing risk through coverage metrics.
c. Output/Visualization Layer:
– Generated Reports: HTML, SVG charts, Markdown, CSV, and other output formats.
– Angular based UI: In the src/AngularComponents folder you have components for displaying coverage info, risk hotspots, and interactive charting (e.g., coverage-bar, coverage-history-chart).
– Command Line Interface (CLI): The ReportGenerator.Console and DotnetGlobalTool components are responsible for accepting parameters and invoking the core logic.
– MSBuild & Deployment Integration: Components supporting build pipelines and package deployables (nuget, chocolatey, etc.)
Relationships and Data Flows
• Within the Core Processing layer, represent the flow from:
Input Parsers → Data Preprocessing/Filtering → Report Generation Engine → various Builder modules.
• Plug-in points where the ReportGenerator.Core can load external assemblies for custom reports or history storage.
• That the integration modules (Azure DevOps task, MSBuild task, Dotnet global tool) all eventually call into the same core libraries.
• Configuration feed from the .netconfig file into the command-line/processing workflow.
Architectural Patterns and Principles
• Use abstraction and modularization: Each parser and builder can be considered to follow the strategy or builder pattern.
• Separation of concerns: The tool separates data ingestion (parsing), processing (filtering, analysis), and output (report building).
• Plug-in architecture: Clearly mark extension points where additional report types or custom history storage modules can be integrated.
• Multi-platform integration: The same core functionality is exposed via several “front ends” (CLI, Angular UI, MSBuild, global tool).