Module

utils.sarif

SARIF (Static Analysis Results Interchange Format) to dict converter.

Stdlib-only converter for SARIF v2.1.0 JSON files. Handles output from CodeQL, ESLint, Semgrep, Trivy, and other SARIF-producing tools.

Classes

SARIFSummary 4 ▼
Aggregate counts by severity level.

Aggregate counts by severity level.

Attributes

Name Type Description
total int —
errors int —
warnings int —
notes int —
SARIFResult 5 ▼
A single static analysis finding.

A single static analysis finding.

Attributes

Name Type Description
rule_id str —
level str —
message str —
file str —
line int —
SARIFReport 4 ▼
Top-level SARIF parse result.

Top-level SARIF parse result.

Attributes

Name Type Description
tool str —
version str —
summary SARIFSummary —
results list[SARIFResult] —

Functions

sarif_to_dict 1 SARIFReport ▼
Parse a SARIF JSON file and return a normalized dict.
def sarif_to_dict(path: str | Path) -> SARIFReport
Parameters
Name Type Description
path str | Path

Path to the SARIF JSON file.

Returns
SARIFReport