Repository navigation
fix: give CC017 advice that works before the commit exists - #685
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 54 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 #685 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 14 14
Lines 2529 2533 +4
Branches 491 492 +1
=========================================
+ Hits 2529 2533 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
In the commit-msg hook, or for a piped message, CC017 suggested git commit --amend --reset-author. The commit does not exist yet, so --amend would rewrite the previous one, and --reset-author records the same AI identity again. It now says to set user.name and user.email (or unset GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL) first.
41d08a2 to
f314115
Compare
|
Merging this PR will not alter performance1 warning
Comparing Footnotes
|



What
CC017 rejects a commit whose author is an AI tool. For a message that is not committed yet (the
commit-msghook, or a piped message), it suggestedgit commit --amend --reset-author. That advice is wrong there:--amendrewrites the commit before it.--reset-authorrecords the identity from the config orGIT_AUTHOR_*again, which is the same AI identity, so the commit still fails.For a pending message, the suggestion now says to set
user.nameanduser.email(or unsetGIT_AUTHOR_NAMEandGIT_AUTHOR_EMAIL) first. The Action pipes existing pull request commits in the same way, so the suggestion ends with the--amend --reset-authorstep for those. With--revor HEAD the advice is unchanged.Before vs after
$ printf 'feat: add x\n' | GIT_AUTHOR_NAME=Claude GIT_AUTHOR_EMAIL=noreply@anthropic.com commit-check -mBefore:
After:
Tests
test_a_message_not_yet_committed_is_not_told_to_amendcovers stdin and a message file. The existing tests for--revand HEAD still expect the old text.