> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kafkalabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ReportGenerator

> API reference for the ReportGenerator class

## Overview

The `ReportGenerator` class formats scan findings into beautiful, readable console reports.

## Constructor

```javascript theme={null}
new ReportGenerator()
```

**Example:**

```javascript theme={null}
const ReportGenerator = require('kafkacode/dist/ReportGenerator');

const reporter = new ReportGenerator();
```

## Methods

### generateReport(directory, findings, filesScanned)

Generates a formatted privacy scan report.

```javascript theme={null}
generateReport(
  directory: string,
  findings: Finding[],
  filesScanned: number
): string
```

**Parameters:**

* `directory` (string): Directory that was scanned
* `findings` (Finding\[]): Array of findings
* `filesScanned` (number): Number of files scanned

**Returns:** Formatted report string

**Example:**

```javascript theme={null}
const ReportGenerator = require('kafkacode/dist/ReportGenerator');

const reporter = new ReportGenerator();
const report = reporter.generateReport('./src', findings, 25);

console.log(report);
```

## Usage Example

### Complete Scan with Report

```javascript theme={null}
const FileScanner = require('kafkacode/dist/FileScanner');
const AnalysisEngine = require('kafkacode/dist/AnalysisEngine');
const ReportGenerator = require('kafkacode/dist/ReportGenerator');

async function scanAndReport(directory) {
  // Discover files
  const scanner = new FileScanner(directory);
  const files = scanner.scanFiles();

  // Analyze files
  const engine = new AnalysisEngine();
  const findings = await engine.analyzeFiles(files);

  // Generate report
  const reporter = new ReportGenerator();
  const report = reporter.generateReport(directory, findings, files.length);

  console.log(report);

  return findings;
}

scanAndReport('./src');
```

## Report Format

The generated report includes:

* **Header**: Privacy Scan Report title
* **Summary**: Directory, timestamp, files scanned, issues found, privacy grade
* **Issue Listings**: Grouped by severity with details
* **Recommendations**: Actionable advice for each issue

## Next Steps

<CardGroup cols={2}>
  <Card title="Interpreting Results" icon="chart-line" href="/usage/interpreting-results">
    Learn to read scan reports
  </Card>

  <Card title="Privacy Grading" icon="shield" href="/concepts/privacy-grading">
    Understand the grading system
  </Card>
</CardGroup>
