diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-25 13:43:13 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-25 13:43:13 +0000 |
| commit | 1de74ce840ab45e0d6f6aa2d75f70be8076fe476 (patch) | |
| tree | aaa1482a96337cdf50d36a64b087b1652d323900 /grasp-audit/src/probe.rs | |
| parent | a6bbcc8b16235903fa2fee75a90618ed57bc89a7 (diff) | |
hide read-only mode skips from human and JSON probe output
Diffstat (limited to 'grasp-audit/src/probe.rs')
| -rw-r--r-- | grasp-audit/src/probe.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/grasp-audit/src/probe.rs b/grasp-audit/src/probe.rs index d6c1482..8976400 100644 --- a/grasp-audit/src/probe.rs +++ b/grasp-audit/src/probe.rs | |||
| @@ -55,6 +55,12 @@ impl ProbeReport { | |||
| 55 | 55 | ||
| 56 | for check in &self.checks { | 56 | for check in &self.checks { |
| 57 | if check.skipped { | 57 | if check.skipped { |
| 58 | // Don't list checks skipped due to read-only mode — they are | ||
| 59 | // not applicable, not failures. Only show skips caused by | ||
| 60 | // earlier check failures so the user can see the causal chain. | ||
| 61 | if check.error.as_deref() == Some("read-only mode") { | ||
| 62 | continue; | ||
| 63 | } | ||
| 58 | let reason = check.error.as_deref().unwrap_or("skipped"); | 64 | let reason = check.error.as_deref().unwrap_or("skipped"); |
| 59 | println!( | 65 | println!( |
| 60 | "{}→{} {:<28} skipped {}({}){} ", | 66 | "{}→{} {:<28} skipped {}({}){} ", |
| @@ -103,7 +109,18 @@ impl ProbeReport { | |||
| 103 | 109 | ||
| 104 | /// Print machine-readable JSON | 110 | /// Print machine-readable JSON |
| 105 | pub fn print_json(&self) { | 111 | pub fn print_json(&self) { |
| 106 | println!("{}", serde_json::to_string_pretty(self).unwrap()); | 112 | // Exclude checks skipped due to read-only mode — they are not |
| 113 | // applicable and would clutter automated consumers. | ||
| 114 | let filtered = ProbeReport { | ||
| 115 | checks: self | ||
| 116 | .checks | ||
| 117 | .iter() | ||
| 118 | .filter(|c| !(c.skipped && c.error.as_deref() == Some("read-only mode"))) | ||
| 119 | .cloned() | ||
| 120 | .collect(), | ||
| 121 | ..self.clone() | ||
| 122 | }; | ||
| 123 | println!("{}", serde_json::to_string_pretty(&filtered).unwrap()); | ||
| 107 | } | 124 | } |
| 108 | } | 125 | } |
| 109 | 126 | ||