codeguard analyze
codeguard analyze <path> [options]
<path> ist der Pfad zu einer .sln- oder .csproj-Datei.
Beispiele
# Default-Lauf gegen die Solution, Output auf der Konsole
codeguard analyze MySolution.sln
# JSON-Output in eine Datei
codeguard analyze MySolution.sln --output json --output-file findings.json
# Nur Errors als Build-Blocker, GitHub-Annotations für PR-Inline-Kommentare
codeguard analyze MySolution.sln --output github-annotations --fail-on error
# Regelmenge aus einem anderen Verzeichnis
codeguard analyze MySolution.sln --rules ./shared-rules
Optionen
| Option | Default | Beschreibung |
|---|---|---|
--rules <dir> |
./rules |
Verzeichnis mit .cgr-Regeln. Default ist ./rules im aktuellen Verzeichnis, mit Fallback auf die Beispiel-Regeln neben der CLI. |
--output <format> |
console |
Output-Format: console, json, sarif, github-annotations. Siehe Output-Formate. |
--output-file <path> |
stdout | Output in eine Datei statt stdout schreiben. |
--severity <level> |
info |
Minimale Severity die im Output erscheint: info, warn, error. |
--fail-on <level> |
nicht gesetzt | Exit-Code 1 bei Findings ab dieser Severity: info, warn, error. |
--no-color |
aus | ANSI-Farbcodes im Konsolen-Output deaktivieren. |
--verbose |
aus | Detaillierte Diagnose-Logs. |
--workspace-root <path> |
nicht gesetzt | Path-Prefix das aus Datei-Pfaden gestrippt wird. Nützlich für github-annotations. |
Exit-Codes
0: Lauf erfolgreich, keine Findings über der--fail-on-Schwelle.1: Findings über der--fail-on-Schwelle gefunden.2: Konfigurations- oder Regel-Fehler.
Mehr unter Exit-Codes.