feat: Allow specifying the base commit for local (non-CI) diffs#180
feat: Allow specifying the base commit for local (non-CI) diffs#1802bndy5 merged 17 commits intocpp-linter:mainfrom
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughAdds optional diff selection and index-ignoring flags: Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #180 +/- ##
==========================================
+ Coverage 98.27% 98.30% +0.02%
==========================================
Files 24 24
Lines 1916 1947 +31
==========================================
+ Hits 1883 1914 +31
Misses 33 33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This comment was marked as resolved.
This comment was marked as resolved.
c4de8ea to
f9b56dc
Compare
|
I did not mean to close this. |
This comment was marked as outdated.
This comment was marked as outdated.
- fixed a sphinx formatting issue - changed replaced type with isinstance in get_sha
Co-authored-by: Brendan <[email protected]>
Co-authored-by: Brendan <[email protected]>
Co-authored-by: Brendan <[email protected]>
There was a problem hiding this comment.
This looks great, thanks!
I have some final requests about the docs and --ignore-index CLI parsing.
Also, could you apply the following patch to conf.py:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -238,6 +238,7 @@ REQUIRED_VERSIONS = {
"1.8.1": ["jobs"],
"1.9.0": ["ignore_tidy", "ignore_format"],
"1.10.0": ["passive_reviews"],
+ "1.12.0": ["diff_base", "ignore_index"],
}
SUBCOMMAND_VERSIONS = {"version": "1.11.0"}It will help when generating the CLI doc from the --help output. Currently, it is incorrect:

Yes, I intend to bump the minor version because this is a new feature.
Co-authored-by: Brendan <[email protected]>
csv table in doc for clarity Co-authored-by: Brendan <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@cpp_linter/rest_api/__init__.py`:
- Around line 171-180: The docstring for parameter diff_base in __init__.py has
the diff ranges reversed; update the CSV table so ranges are "older..newer"
(base → head/index): replace "HEAD..HEAD~1" with "HEAD~1..HEAD" and replace
"index..HEAD" with "HEAD..index" so the examples for diff_base (in the table
under the diff_base param) show the correct base→target ordering.
2bndy5
left a comment
There was a problem hiding this comment.
Small doc revision about CLI option vs switch.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- ref cpp-linter/cpp-linter#180 - as discussed in cpp-linter/cpp-linter#179 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added --diff-base and --ignore-index CLI options to control base diffs and staged-file handling. * **Documentation** * Documented new CLI options (minimum version 1.12.0). * Improved CLI argument header formatting to handle missing short names. * **Chores** * Default test filter updated to exclude a specific test. * **Tests** * Tests expanded to cover diff-base and ignore-index behaviors and updated call sites. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
In porting #180 to rust (cpp-inter/cpp-linter-rs#260), I found a few spots for improvement. These changes should be more performant when there are staged changes. I also made some typing-related changes to satisfy mypy.
In porting #180 to rust (cpp-linter/cpp-linter-rs#260), I found a few spots for improvement. These changes should be more performant when there are staged changes.
In porting #180 to rust (cpp-linter/cpp-linter-rs#260), I found a few spots for improvement. These changes should be more performant when there are staged changes.
In porting #180 to rust (cpp-linter/cpp-linter-rs#260), I found a few spots for improvement. These changes should be more performant when there are staged changes.
Changes in this PR only affect behavior in a non CI or non GitHub environment.
Resolves #179
Previous behavior
If staged files exist, then use diff between HEAD and index (staging).
Otherwise, use the diff between HEAD~1 and HEAD.
New behavior
Previous behavior is unchanged. Options were added to allow:
--diff-base BASEand empty index: diff between BASE and HEAD--diff-base BASEand populated index: diff between BASE and index--ignore-index: follows behavior as if the index is empty.Thus,
--diff-base BASEand--ignore-index--> always diff between BASE and HEADSummary by CodeRabbit
New Features
Behavior
Tests
Documentation