-
Notifications
You must be signed in to change notification settings - Fork 67
Address code review comments from PR #1518 #1582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@claude address review feedback |
|
I'll analyze this and get back to you. |
|
Claude finished @vlad-ivanov-name's task —— View job Addressing Review FeedbackAll review comments have been addressed! ✅
Changes Made
The changes improve error handling clarity and avoid hidden control flow as requested. --- | |
|
@claude fix the failing build |
|
Claude finished @christian-schilling's task —— View job Build Failure FixedAll formatting errors have been resolved! ✅
Changes MadeFixed Rust formatting errors in
The build should now pass the |
29e9c96 to
08fa777
Compare
This commit addresses the unresolved review comments from the merged PR that added the josh CLI tool: ## Error Handling Improvements - Add anyhow and thiserror to workspace dependencies - Replace Box<dyn std::error::Error> with anyhow::Result throughout josh-cli - Use anyhow::Context for better error messages with context ## josh-core/src/changes.rs Improvements - Use into_iter() instead of iter() where changes vec is consumed - Replace manual indexing with .windows(2) for cleaner iteration - Use iterator chaining with base_tree for tree collection - Use HashSet::insert() which returns false for duplicates - Improve variable naming: old -> base_oid, v -> push_refs - Change ref_with_options parameter from String to &str for consistency - Replace if let with match for better pattern matching - Use filter_map instead of filter + map ## josh-cli/src/bin/josh.rs Improvements - Remove all std::env::set_current_dir() calls (hacky global state) - Create internal helper functions that accept repo_path parameter: - handle_fetch_internal(args, repo_path) - handle_remote_add_internal(args, repo_path) - handle_filter_internal(args, repo_path, print_messages) - apply_josh_filtering(repo_path, filter, remote_name) - Remove commented out code - Update all error handling to use anyhow::Context - Fix build_to_push call to pass &remote_ref instead of remote_ref 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Vlad Ivanov <vlad-ivanov-name@users.noreply.github.com>
08fa777 to
eb2aa0b
Compare
christian-schilling
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think josh.rs looks a lot better with those changes. changes.rs not so much.
josh-core/src/changes.rs
Outdated
| if let Some(id) = &change.id { | ||
| if id.contains('@') { | ||
| return Err(josh_error("Change id must not contain '@'")); | ||
| match &change.id { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really prefer if let over match in cases where only one of the cases needs data. It's easier to type due to less special characters and easier to read do to less nesting.
josh-core/src/changes.rs
Outdated
| if push_mode == PushMode::Review { | ||
| v.push(( | ||
| ref_with_options.clone(), | ||
| match changes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, I think if let is better.
josh-core/src/changes.rs
Outdated
| .map(|(_, commit, _)| repo.find_commit(*commit)) | ||
| .collect::<Result<Vec<_>, _>>()?; | ||
|
|
||
| let base_tree = std::iter::once(repo.find_commit(base)?.tree()?); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't particularly like the changed version since it has two more concepts (this "iter once" and interator chaining) and more indentation than the old one.
Maybe it could be better to do the map over all commits first and then have the commit -> tree just once. (keeping the once + chain, but i think it would still be simpler)
| eprintln!("Error: {}", e); | ||
| std::process::exit(1); | ||
| } | ||
| let result = match &cli.command { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, this is a lot better! :)
|
@claude address review feedback |
|
Claude finished @christian-schilling's task —— View job Addressing Review FeedbackAll review feedback has been addressed! ✅
Changes Made
These changes improve code readability while maintaining the same functionality. The changes have been pushed to the PR branch. |
- Change match back to if let at lines 125 and 175 (cleaner for single-data-case patterns) - Simplify iterator chaining at line 57 (use vec with extend instead of iter::once + chain) Co-authored-by: Christian Schilling <christian-schilling@users.noreply.github.com>
|
@claude fix the failed build |
|
Claude finished @christian-schilling's task —— View job Build Failure FixedAll formatting issues have been resolved! ✅
Changes MadeFixed Rust formatting error in The build should now pass the |
The line calling trees.extend() exceeded the line length limit. Reformatted to split across multiple lines for better readability. Co-authored-by: Christian Schilling <christian-schilling@users.noreply.github.com>

This commit addresses the unresolved review comments from the merged PR that added the josh CLI tool:
Error Handling Improvements
josh-core/src/changes.rs Improvements
josh-cli/src/bin/josh.rs Improvements
🤖 Generated with Claude Code