chore: expand imperative verb whitelist and improve validation logic - #527
Conversation
CC003 matches the subject's first word against a fixed list, so a verb missing
from it rejects a subject that was written correctly. The contributor then has
to reword something that was never wrong, and the only way to learn which words
are acceptable is trial and error.
Measured against 40,000 git.git subjects — a project that writes strictly
imperative subjects, with its area prefixes stripped so only the verb is
compared — the list rejected 17.9% of them. This brings that to 10.5%.
The additions come from that corpus, filtered by hand to unambiguous verbs:
avoid, clarify, teach, factor, free, mention, plug, inline, restore, retire,
treat, tighten and the rest. Adverb-led subjects ("always quote the path") and
non-verbs were left out — the first are correct English the list cannot
represent, and the second would weaken the check.
Both spellings of every -ize/-ise verb are now present. The file had sixteen
-ize verbs and four -ise ones, so a project writing British English was being
told "normalise" is not imperative.
Wrong forms still fail, which is the property that matters: "updated the
parser", "adding a new flag", "fixes the crash" and "removed the dead code" are
covered by a test alongside the recovered words.
The remaining 10.5% is the point of the follow-up issue: a list can only ever
approximate "is this an English imperative verb".
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U9zFxq8V4qxG4aMzJhGBFn
📝 WalkthroughWalkthroughChangesImperative subject validation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
They assert which subjects are accepted, not how fast the check runs, and marking them adds twelve identical-cost cases to what CodSpeed measures. The companion test for wrong verb forms was already unmarked, so the pair was inconsistent as well. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U9zFxq8V4qxG4aMzJhGBFn
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/engine_test.py (1)
1356-1371: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExercise a newly added spelling pair in this test.
serialisealready exists incommit_check/imperatives.pyat Lines 439-440. This case does not verify the vocabulary expansion. The test also does not cover both spellings of a newly added-ise/-izepair. Replace it withcustomiseandcustomize, added at Lines 98-99.Suggested test update
- "refactor: serialise the payload", + "refactor: customise the payload", + "refactor: customize the payload",🤖 Prompt for 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. In `@tests/engine_test.py` around lines 1356 - 1371, Update the imperative-message test cases by replacing the existing “serialise” entry with both “customise” and “customize,” using the corresponding imperative phrases. Keep the cases in the rejected-message list and preserve the existing spelling-pair coverage intent.
🤖 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.
Nitpick comments:
In `@tests/engine_test.py`:
- Around line 1356-1371: Update the imperative-message test cases by replacing
the existing “serialise” entry with both “customise” and “customize,” using the
corresponding imperative phrases. Keep the cases in the rejected-message list
and preserve the existing spelling-pair coverage intent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 34687327-1676-4f7e-9650-f2418781a3f6
📒 Files selected for processing (2)
commit_check/imperatives.pytests/engine_test.py
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #527 +/- ##
==========================================
+ Coverage 97.40% 97.68% +0.28%
==========================================
Files 12 12
Lines 1231 1254 +23
==========================================
+ Hits 1199 1225 +26
+ Misses 32 29 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The British-spelling case used serialise, which the file already contained before this change, so it proved nothing about the addition. customise is the useful one: customize was listed and customise was not, which is exactly the half-a-pair bug the sweep was meant to close. Both spellings are now asserted. Reported by CodeRabbit on #527, and correct — verified against the merge base that serialise predates the change while customise does not. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U9zFxq8V4qxG4aMzJhGBFn
|
Merging this PR will improve performance by ×2.9
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | test_empty_message_passes |
6.7 ms | 2.3 ms | ×2.9 |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing claude/refresh-sample-output-602anc (5289553) with main (a0d3f77)2
Footnotes
-
121 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
-
No successful run was found on
main(3ba4f08) during the generation of this report, so a0d3f77 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
The pin was v2.13.0, whose requirements.txt installs commit-check 2.13.1. That engine cannot resolve a rebase target existing only as origin/main in a pull request checkout, so it reported "not rebased" for a branch that was -- the false CC202 this workflow has carried since its first run. v2.13.1 of the action installs commit-check 2.13.4, which carries the merge-base fix from #532. Confirmed by reading requirements.txt at the tag rather than assuming the action version tracks the engine version: v2.13.0 (124de73) -> commit-check==2.13.1 v2.13.1 (562a184) -> commit-check==2.13.4 The branch was already rebased before this change -- git merge-base --is-ancestor origin/main HEAD returned true while CC202 still failed -- so the failure was the engine, not the branch, and rebasing again could never have fixed it. Two things ride along on the newer engine. Skipped checks now report as skipped rather than as passes (#537), so a run bypassed by ignore_authors says so instead of showing green ticks over nothing. And the imperative whitelist goes from 396 verbs to 529, retiring a class of false CC003 -- 2.13.1 rejected "treat", which #527 had added three releases earlier. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U9zFxq8V4qxG4aMzJhGBFn



Summary
Extended the imperative verb whitelist in
commit_check/imperatives.pywith 100+ additional verbs and added comprehensive test coverage to ensure correct imperative forms are not rejected while maintaining validation of incorrect verb forms.Key Changes
Expanded IMPERATIVES set: Added 100+ new imperative verbs including:
be,do,die,let,work,teach,treatnormalise,prioritise,serialise) alongside American variantsdeduplicate,hoist,inline,paginate,shard,stub,subclassUpdated documentation: Clarified the philosophy in comments:
-izeand-isespellings are includedAdded test coverage:
test_correct_imperative_subjects_are_not_rejected()test with 12 real-world examples that were previously rejectedtest_wrong_verb_forms_still_fail()test to ensure the validation still catches actual errors (past tense, gerunds, etc.)Implementation Details
The changes maintain backward compatibility while significantly improving the validator's accuracy. The expanded list now covers most common imperative verbs encountered in commit messages, reducing false rejections while the new tests ensure the rule still catches genuinely incorrect verb forms.
https://claude.ai/code/session_01U9zFxq8V4qxG4aMzJhGBFn
Summary by CodeRabbit