From e1abc18707210103e9359c12a57c555533002560 Mon Sep 17 00:00:00 2001 From: PythonWoods-Dev Date: Thu, 16 Apr 2026 09:47:00 +0200 Subject: [PATCH] fix: exit-code asymmetry in check_orphans/check_assets JSON mode Both commands now check finding severity (error vs warning) before deciding exit codes, consistent with check_references and check_snippets. Warnings no longer trigger Exit 1 in JSON mode. --- CHANGELOG.it.md | 7 +++++++ CHANGELOG.md | 7 +++++++ src/zenzic/cli.py | 6 ++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.it.md b/CHANGELOG.it.md index 030b10f..989b885 100644 --- a/CHANGELOG.it.md +++ b/CHANGELOG.it.md @@ -22,6 +22,13 @@ Le versioni seguono il [Semantic Versioning](https://semver.org/). rileva ora i token `glpat-` (9 famiglie di credenziali in totale). ([#57](https://github.com/PythonWoods/zenzic/pull/57) — contributo di [@gtanb4l](https://github.com/gtanb4l)) +### Corretto + +- **Asimmetria exit-code JSON in `check orphans` e `check assets`.** Entrambi i comandi + ora distinguono la severità `error` da `warning` prima di decidere il codice di uscita, + in modo coerente con `check references` e `check snippets`. In precedenza, qualsiasi + finding (inclusi i warning) attivava Exit 1 in modalità JSON. + ## [0.6.1rc1] — 2026-04-15 — Obsidian Bastion ### Breaking Changes diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f573c8..76edb0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,13 @@ Versions follow [Semantic Versioning](https://semver.org/). detects `glpat-` tokens (9 credential families total). ([#57](https://github.com/PythonWoods/zenzic/pull/57) — contributed by [@gtanb4l](https://github.com/gtanb4l)) +### Fixed + +- **JSON exit-code asymmetry in `check orphans` and `check assets`.** Both commands + now distinguish `error` vs `warning` severity before deciding exit codes, consistent + with `check references` and `check snippets`. Previously, any finding (including + warnings) triggered Exit 1 in JSON mode. + ## [0.6.1rc1] — 2026-04-15 — Obsidian Bastion ### Breaking Changes diff --git a/src/zenzic/cli.py b/src/zenzic/cli.py index 038ecf8..128a808 100644 --- a/src/zenzic/cli.py +++ b/src/zenzic/cli.py @@ -377,7 +377,8 @@ def check_orphans( if output_format == "json": _output_json_findings(findings, elapsed) - if findings: + errors_count = sum(1 for f in findings if f.severity == "error") + if errors_count: raise typer.Exit(1) return @@ -643,7 +644,8 @@ def check_assets( if output_format == "json": _output_json_findings(findings, elapsed) - if findings: + errors_count = sum(1 for f in findings if f.severity == "error") + if errors_count: raise typer.Exit(1) return