# danielpalme/reportgenerator architecture

> Architecture diagram of the GitHub repository danielpalme/reportgenerator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/danielpalme/reportgenerator
- Repository: https://github.com/danielpalme/reportgenerator

## Overview

##### 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).

## Diagram (Mermaid)

```mermaid
graph TB
  %% Top Level: User/Build Environment
  UBE("User/Build Environment"):::external

  %% Input/Integration Layer
  subgraph "Input/Integration Layer"
    CRI("Coverage Report Input"):::integration
    subgraph "Integration Modules"
      ADT("Azure DevOps Task"):::integration
      MST("MSBuild Task Integration"):::integration
      DGT("Dotnet Global Tool Integration"):::integration
      NET(" .netconfig Support"):::integration
    end
  end

  %% Core Processing Layer
  subgraph "Core Processing Layer"
    CORE("Core Library (Program.cs)"):::core
    PAR("Parser Modules"):::core
    PRE("Preprocessing Modules"):::core
    FIL("Filtering Modules"):::core
    RISK("Risk Hotspots Analysis"):::core
    PLUG("Plugin Loader"):::core
    ENG("Report Generation Engine"):::core
    RB("Report Builders"):::core
    REN("Rendering Submodules"):::core
  end

  %% Output/Visualization Layer
  subgraph "Output/Visualization Layer"
    CLI("CLI Interfaces"):::output
    REP("Generated Report Resources"):::output
    ANG("Angular UI"):::output
  end

  %% Data Flow Connections
  UBE -->|"generates coverage files"| CRI
  UBE -->|"triggers tools"| ADT
  UBE --> MST
  UBE --> DGT
  UBE --> NET

  CRI --> ENG
  ADT --> ENG
  MST --> ENG
  DGT --> ENG
  NET --> ENG

  CORE --> PAR
  PAR --> PRE
  PRE --> FIL
  FIL --> ENG
  PLUG --> ENG
  RISK --> ENG
  ENG --> RB
  RB --> REN

  %% Core Engine invocation from integration (CLI)
  CLI --> CORE

  %% Output Flow
  ENG --> REP
  REP --> ANG

  %% Click Events for Input/Integration Layer
  click ADT "https://github.com/danielpalme/reportgenerator/tree/main/src/AzureDevopsTask"
  click MST "https://github.com/danielpalme/reportgenerator/blob/main/src/ReportGenerator.MSBuild"
  click DGT "https://github.com/danielpalme/reportgenerator/blob/main/src/ReportGenerator.DotnetGlobalTool"
  click NET "https://github.com/danielpalme/reportgenerator/blob/main/src/ReportGenerator.Core/appsettings.json"

  %% Click Events for Core Processing Layer
  click CORE "https://github.com/danielpalme/reportgenerator/blob/main/src/ReportGenerator.Core/Program.cs"
  click PAR "https://github.com/danielpalme/reportgenerator/tree/main/src/ReportGenerator.Core/Parser"
  click PRE "https://github.com/danielpalme/reportgenerator/tree/main/src/ReportGenerator.Core/Parser/Preprocessing"
  click FIL "https://github.com/danielpalme/reportgenerator/tree/main/src/ReportGenerator.Core/Parser/Filtering"
  click RISK "https://github.com/danielpalme/reportgenerator/tree/main/src/ReportGenerator.Core/CodeAnalysis"
  click PLUG "https://github.com/danielpalme/reportgenerator/tree/main/src/ReportGenerator.Core/Plugin"
  click RB "https://github.com/danielpalme/reportgenerator/tree/main/src/ReportGenerator.Core/Reporting/Builders"
  click REN "https://github.com/danielpalme/reportgenerator/tree/main/src/ReportGenerator.Core/Reporting/Builders/Rendering"

  %% Click Events for Output/Visualization Layer
  click ANG "https://github.com/danielpalme/reportgenerator/tree/main/src/AngularComponents"
  click CLI "https://github.com/danielpalme/reportgenerator/blob/main/src/ReportGenerator.Console"
  
  %% Additional CLI mapping for .Net Core Console
  click CLI "https://github.com/danielpalme/reportgenerator/blob/main/src/ReportGenerator.Console.NetCore"

  %% Styles for Nodes
  classDef external fill:#f9f,stroke:#333,stroke-width:2px;
  classDef integration fill:#ccf,stroke:#333,stroke-width:2px;
  classDef core fill:#ffc,stroke:#333,stroke-width:2px;
  classDef output fill:#cfc,stroke:#333,stroke-width:2px;
```
