v0.2.2-beta

Reference

Output formats.

ngcompass supports four output formats via the --format flag. The default is console, which prints colored results to the terminal.

At a glance

  • --format consoledefault

    Colored terminal output with severity badges and indexed failure cards. Supports --compact for ESLint-style single-line output.

  • --format html

    Self-contained interactive HTML report with charts, per-file drill-down, search, and filters.

  • --format json

    Machine-readable JSON to stdout. Pipe to a file or a custom pipeline script.

  • --format sarif

    SARIF 2.1.0 to stdout. Upload to GitHub Code Scanning for inline PR annotations.

console (default)

Prints append-only progress rows while files are analyzed, followed by severity badges, indexed failure cards, recommendations, and source context. This is the default when no --format flag is provided.

bash
01npx ngcompass analyze

Use --compact for ESLint-style single-line output — useful in CI logs where you want minimal noise:

bash
01npx ngcompass analyze --format console --compact

Example compact output:

src\cases\component-no-manual-detect-changes\invalid-detect-changes.component.ts

15:3errorConstructor dependency injection makes class setup less composable than inject(). Offending params: cdr: ChangeDetectorRefprefer-inject-over-constructor-di
19:5errorManual change detection in an OnPush component couples rendering to imperative callscomponent-no-manual-detect-changes

src\cases\component-no-manual-detect-changes\invalid-mark-for-check-default-cd.component.ts

11:3errorConstructor dependency injection makes class setup less composable than inject(). Offending params: cdr: ChangeDetectorRefprefer-inject-over-constructor-di

html — interactive HTML report

Generates a self-contained HTML file with severity charts, per-file drill-down, search, and filters. Open it in any browser; no server required.

bash
01# Write report to default location (ngcompass-report.html)
02npx ngcompass analyze --format html
03
04# Write report to a custom path
05npx ngcompass analyze --format html --output ./reports/analysis.html

json — machine-readable

Emits a structured JSON object to stdout. Pipe it to a file or a custom pipeline script.

bash
01npx ngcompass analyze --format json > results.json

Example output shape:

json
01[
02 {
03 "filePath": "src/cases/component-no-manual-detect-changes/invalid-detect-changes.component.ts",
04 "messages": [
05 {
06 "ruleId": "prefer-inject-over-constructor-di",
07 "severity": 2,
08 "message": "Constructor dependency injection makes class setup less composable than inject(). Offending params: cdr: ChangeDetectorRef.",
09 "line": 15,
10 "column": 3
11 },
12 {
13 "ruleId": "component-no-manual-detect-changes",
14 "severity": 2,
15 "message": "Manual change detection in an OnPush component couples rendering to imperative calls.",
16 "line": 19,
17 "column": 5
18 }
19 ],
20 "errorCount": 2,
21 "warningCount": 0
22 },
23 {
24 "filePath": "src/cases/component-no-manual-detect-changes/invalid-mark-for-check-default-cd.component.ts",
25 "messages": [
26 {
27 "ruleId": "prefer-inject-over-constructor-di",
28 "severity": 2,
29 "message": "Constructor dependency injection makes class setup less composable than inject(). Offending params: cdr: ChangeDetectorRef.",
30 "line": 11,
31 "column": 3
32 }
33 ],
34 "errorCount": 1,
35 "warningCount": 0
36 }
37]

sarif — GitHub Code Scanning

Emits SARIF 2.1.0 to stdout. Upload the file to GitHub Code Scanning for inline annotations on pull requests.

bash
01# Emit SARIF and upload to GitHub Code Scanning
02npx ngcompass analyze --format sarif > results.sarif

See the CI Integration guide for the full GitHub Actions workflow.