Repository navigation
feat: add --gen-patch-path to choose where the patch is written - #538
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 41 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #538 +/- ##
=======================================
Coverage 99.82% 99.82%
=======================================
Files 29 29
Lines 7360 7432 +72
=======================================
+ Hits 7347 7419 +72
Misses 13 13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Yeah, let's do that as a followup. |
…nst the working directory (#541) Follow-up to #538, as discussed there: `--gen-patch-path` resolves a relative path against the current working directory, so the other output paths now do the same instead of resolving against `--repo-root`. ## Changes - `FeedbackInput::from(&Cli)` makes `summary_output_file` and `sarif_file` absolute (against the cwd), sharing a small `absolute_or_given()` helper with `patch_path`. - `RestClient::post_feedback()` writes to those paths as given (no more `repo_root.join()`). - Help text for both options now says a relative path is relative to the current working directory. - Tests: - new unit test `relative_output_files` (relative paths resolve against the cwd even with `--repo-root sub`). - the `relative_out_files` integration test now writes into a temp dir made in the cwd and passes a path relative to the cwd. This changes behavior for anyone passing a relative `--summary-output-file`/`--sarif-file` together with a `--repo-root` that isn't the cwd. I'll note it in the migration guide (#535). <!-- claude-projects-attribution: {"github_login":"shenxianpeng"} --> Co-authored-by: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com>
As suggested in #535 (comment): a new
--gen-patch-path <PATH>option (also read from theGEN_PATCH_PATHenv var) sets where the combined fix patch is written, so users can rungit apply "$GEN_PATCH_PATH"without copying the path from the logs.--gen-patch.--databasein fix: resolve a relative--databaseagainst the working directory #537, and whatgit applyexpects). Note that--summary-output-fileand--sarif-filestill resolve against--repo-root; happy to switch this one to match those if you prefer.<repo-root>/.cpp-linter-cache/auto-fix.patch, andfix-patch-pathreports whichever path was used.Implementation:
FeedbackInput::patch_pathholds the resolved path;ClangParams::default_patch_path()builds the default.FileObj::maybe_append_patch()andmake_suggestions_from_patch()take the patch path instead of building it fromrepo_root(both arepub, so this changes their signatures).clapenables theenvfeature (no new crates inCargo.lock).cli::structs::test::{default_patch_path, gen_patch_path_implies_gen_patch, gen_patch_path_from_env}andrun::test::custom_patch_path(stale file replaced, nothing written to the default path).Checked locally with clang 21: all
cpp-linterlib tests (120),--test comments(17) and--test reviews(16) pass single-threaded (plaincargo testraces on env vars, nextest doesn't);cargo clippy --all-features --all-targetsclean; the generated CLI doc renders the option and its example block.