Skip to content

fix(findings): make --severity filter and list colouring case-insensitive - #588

Merged
ajianaz merged 1 commit into
developfrom
fix/findings-severity-case
Oct 8, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/findings-severity-case

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

What

  • cora findings list --severity <x> now matches regardless of argument case (argument lowercased to match the stored form).
  • The list renderer picks red/yellow/green via a new pure severity_color() helper that matches case-insensitively, so colouring actually applies.
  • --severity is validated by clap (info|minor|major|critical, any case); unknown values fail with a clear error instead of silently returning nothing.
  • The test that pinned the old buggy behaviour now asserts the corrected behaviour.

Why

Severities are stored lowercase, but the filter upper-cased its argument (never matched) and the renderer compared against uppercase literals (colouring dead). Stored data, JSON keys and stats labels are unchanged. Closes #586

Testing

  • cargo clippy --all-targets --features tree-sitter -- -D warnings clean; cargo fmt applied.
  • cargo test --features tree-sitter --bin cora -- review_store findings: 82 passed (filter for each case variant, unknown value, severity_color, clap parse accept/reject, stats labels still lowercase). index:: / watch:: skipped locally (stray flock); CI runs everything.
  • Smoke (debug binary, isolated CODECORA_HOME): --severity MAJOR and --severity major both list the major finding; --severity bogus exits 2 with possible values: info, minor, major, critical; list --json unchanged; forced-colour output shows red/yellow/green for critical/major/minor.

🤖 Generated with Claude Code

…tive

Severities are stored lowercase, but the filter upper-cased its argument
(never matching) and the renderer matched uppercase literals (no colour).
Lowercase the filter argument, colour via a pure case-insensitive helper,
and validate --severity (info|minor|major|critical, any case) in clap.

Closes #586

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: ajianaz <ajianaz@users.noreply.github.com>
@ajianaz
ajianaz merged commit c6a02aa into develop Oct 8, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(findings): 'cora findings list --severity' never matches; severity colouring is dead

1 participant