Skip to main content

Overview

The AnalysisEngine class orchestrates the privacy scanning process by combining pattern-based detection with AI-powered analysis.

Constructor

Parameters:
  • verbose (boolean, optional): Enable verbose logging. Default: false
Example:

Properties

verbose

Controls verbose logging output. Type: boolean

patternScanner

Instance of PatternScanner used for regex-based detection. Type: PatternScanner

llmAnalyzer

Instance of LLMAnalyzer used for AI-powered analysis. Type: LLMAnalyzer

Methods

analyzeFile(filePath)

Analyzes a single file for privacy issues.
Parameters:
  • filePath (string): Absolute path to the file
Returns: Promise resolving to array of findings Example:
Process:
  1. Reads file content
  2. Runs PatternScanner for regex detection
  3. Runs LLMAnalyzer for contextual analysis
  4. Combines and returns all findings

analyzeFiles(filePaths)

Analyzes multiple files for privacy issues.
Parameters:
  • filePaths (string[]): Array of absolute file paths
Returns: Promise resolving to array of all findings Example:
Process:
  1. Iterates through each file
  2. Calls analyzeFile() for each
  3. Aggregates all findings
  4. Returns combined results

Usage Examples

Basic Analysis

Verbose Analysis

Batch Analysis

Filter by Severity

Group by File

Error Handling

Custom Analysis Pipeline

Integration Examples

Complete Scan Pipeline

Build Integration

Continuous Monitoring

Performance Optimization

For better performance on large codebases:
For very large files:
Analyze only changed files in git:

API Summary

Next Steps

PatternScanner

Learn about pattern detection

LLMAnalyzer

Explore AI-powered analysis

ReportGenerator

Generate formatted reports

Examples

See practical examples