feat: add option to write summary to file#206
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe PR adds a ChangesSummary output file support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cpp_linter/rest_api/github_api.py`:
- Around line 242-251: The optional summary file write in the `post_feedback()`
flow can raise an `OSError` and abort annotations when
`args.summary_output_file` is invalid or its parent directory is missing. Wrap
the `summary_output_path.open(...)` write path in a best-effort `try/except
OSError` inside the `summary_output_path` handling block, and log the failure
with `log_commander.error` while allowing the rest of `post_feedback()` to
continue. Keep the existing `Path` and `summary_output_path.is_dir()` checks,
and ensure only the extra file output is skipped on failure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3a646e43-3e67-48fd-8775-ba7ae53eba84
📒 Files selected for processing (4)
cpp_linter/cli.pycpp_linter/rest_api/github_api.pytests/comments/test_comments.pytests/test_cli_args.py
2bndy5
left a comment
There was a problem hiding this comment.
The test CI seems to be failing for a separate reason. @shenxianpeng Can you update the CI for the breaking CLI changes in clang-tools-pip v1?
2bndy5
left a comment
There was a problem hiding this comment.
One last tweak.
I'll have to fix the test CI in a separate PR and rebase this branch when that's merged.
- Use option `-o` or `--summary-output-file` to provide a file. - By default the summary will not be written to a file. - If the provided path is a directory, log an error.
Co-authored-by: Brendan <2bndy5@gmail.com>
- Catch OSErrors when writing the summary output file.} - Log the errors, but don't stop the workflow.
c42596c to
7ee169f
Compare
Just see your comment right now after the CI failure was fixed 😅 |
|
Ahh I fucked up the import sorting in my last commit. Let me fix that |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #206 +/- ##
==========================================
+ Coverage 98.29% 98.31% +0.01%
==========================================
Files 24 24
Lines 1938 1958 +20
==========================================
+ Hits 1905 1925 +20
Misses 33 33 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
also updates the --help output about the `--summary-output-file`
slated for v1.13.0
|
New CLI doc looks good too: https://cpp-linter--206.org.readthedocs.build/en/206/cli_args.html#cmdoption-o |
ref - cpp-linter/cpp-linter#205 - cpp-linter/cpp-linter#206 Allows exporting the step summary comment to a custom file path. Useful as a workaround for contexts with restricted permissions (eg private repos). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a new CLI option to save the generated summary to a file. * Summary files can use either an absolute path or a path relative to the repository root. * **Bug Fixes** * Summary content is now generated whenever file output is requested, even if step-based summary posting is off. * Improved error reporting for file and directory write failures. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Closes #205.
-oor--summary-output-fileto provide a file.Summary by CodeRabbit
New Features
-o/--summary-output-fileto write the generated step summary to a specified Markdown file path (use an empty value to disable file output).Bug Fixes
Tests