Skip to content

Commit 6cd3823

Browse files
sachiniyerclaude
andauthored
fix(bugs): print empty-results hint when --vulns alone yields no matches (#264)
## Summary Follow-up to #254. That PR introduced `empty_filter_hint` with a dedicated *"No security vulnerabilities found with the current filters."* branch — and a unit test (`empty_filter_hint_vulns_flag_with_empty_prefilter`) asserting that exact message — but only wired the helper into the `--introduced-by` branch of the handler. When a user runs `detail bugs list --vulns` without an author filter and zero vulnerabilities match, the helper is never reached: they just see an empty table with no explanation. Add the matching early return for the `--vulns`-alone case: if the post-`--vulns` filter is empty and `--introduced-by` wasn't given, print the hint and return. ## Test plan - [x] `cargo test --lib bugs::` — 35 pass - [x] `cargo clippy -- -D warnings` clean - [x] `cargo fmt --check` clean - [ ] Manual: `detail bugs list <repo-without-vulns> --vulns` now prints "No security vulnerabilities found with the current filters." instead of an empty table Fixes #259. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/usedetail/cli/pull/264" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open in Devin Review"> </picture> </a> <!-- devin-review-badge-end --> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 048aa32 commit 6cd3823

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎src/commands/bugs.rs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,16 @@ pub async fn handle(command: &BugCommands, cli: &crate::Cli) -> Result<()> {
337337
}
338338
return output_list(&filtered, 0, *page, *limit, format);
339339
}
340+
} else if filtered.is_empty() {
341+
// `--vulns` alone filtered everything out. Without this
342+
// branch the user just sees an empty table and no hint,
343+
// even though `empty_filter_hint` already has the right
344+
// message for this case.
345+
if matches!(format, crate::OutputFormat::Table) {
346+
let hint = empty_filter_hint(&filtered, *vulns);
347+
Term::stdout().write_line(&hint)?;
348+
}
349+
return output_list(&filtered, 0, *page, *limit, format);
340350
}
341351
let total = filtered.len();
342352
let page_items = paginate_items(&filtered, *page, *limit);

0 commit comments

Comments
 (0)