HTML Report¶
Specification for HTML output generated by pyscn analyze (and by default when no --json/--yaml/--csv flag is given).
File characteristics¶
| Property | Value |
|---|---|
| Path | .pyscn/reports/analyze_YYYYMMDD_HHMMSS.html |
| Encoding | UTF-8 |
| External assets | None (CSS and JS inlined) |
| Dependencies | None (no CDN, no fonts loaded remotely) |
| Size | Typically 50–500 KB |
The file is self-contained and safe to archive, email, or serve from any static host.
Document structure¶
| Element | Contents |
|---|---|
| Header | Project name, generation timestamp, pyscn version, duration. |
| Overall score card | Health Score (0–100), grade badge (A–F). |
| Category score cards | One per enabled analyzer with its 0–100 score. |
| Tabs | Summary, Complexity, Dead Code, Clones, Coupling, Cohesion, Dependencies, Architecture. |
| Footer | Link to pyscn repository and version string. |
Category score cards and tabs only appear for analyzers that ran. Architecture appears only if [architecture] layers are configured.
Tabs¶
| Tab | Contents |
|---|---|
| Summary | High-level numbers and grade. |
| Complexity | Sortable table of functions with McCabe / cognitive complexity, nesting depth, risk. |
| Dead Code | Findings grouped by severity with file:line and reason. |
| Clones | Clone groups with similarity and clone type. |
| Coupling | Classes by CBO with dependency-type breakdown. |
| Cohesion | Classes by LCOM4 with method grouping. |
| Dependencies | Module graph, Ca/Ce/I/A/D metrics, cycles. |
| Architecture | Layer rule violations. |
JavaScript¶
One inline function, showTab(id), switches between tabs. No other scripts execute. No network requests.
CSS¶
Styles use CSS custom properties with these names:
| Variable | Semantic role |
|---|---|
--color-success |
Low-risk findings, grade A. |
--color-warning |
Medium-risk findings, grade B/C. |
--color-danger |
High-risk findings, grade D/F. |
--color-text |
Body text. |
--color-muted |
Secondary text. |
Dark mode follows the prefers-color-scheme media query; no toggle.
Auto-open behavior¶
The report opens in the default browser when all of the following are true:
- Format is HTML.
- Stdin is a TTY.
SSH_TTYandSSH_CONNECTIONenvironment variables are unset.CIenvironment variable is unset.--no-openis not passed.
Open mechanism: open on macOS, xdg-open (or gnome-open / kde-open) on Linux, cmd /c start on Windows.
File URL form: file:///{absolute-path-to-report}.
The report path is always printed to stderr regardless of auto-open.
Suppressing auto-open¶
Or export CI=true in the environment.
Grade badge mapping¶
| Grade | Score | Badge background |
|---|---|---|
| A | 90–100 | Green (--color-success) |
| B | 75–89 | Green-tinted |
| C | 60–74 | Orange (--color-warning) |
| D | 45–59 | Red-tinted (--color-danger) |
| F | 0–44 | Red (--color-danger) |
Cross-references¶
- Health Score — formula for the overall number.
- Schemas — machine-readable alternatives.
- Output Formats — all output formats and stability contract.