Skip to content

feat: add imperative mode #258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 12, 2025
Merged

feat: add imperative mode #258

merged 6 commits into from
Jul 12, 2025

Conversation

shenxianpeng
Copy link
Contributor

@shenxianpeng shenxianpeng commented Jul 12, 2025

closes #256

Summary by CodeRabbit

  • New Features
    • Introduced a commit message check to enforce the use of the imperative mood in commit messages.
    • Added a corresponding pre-commit hook and command-line option for imperative mood checking.
  • Documentation
    • Updated documentation to describe the new imperative mood check and provide usage examples.
  • Tests
    • Added comprehensive tests to validate imperative mood checking functionality.

Copy link
Contributor

coderabbitai bot commented Jul 12, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

A new imperative mood check for commit messages was introduced. This includes a wordlist of imperative verbs, a new check function, CLI integration, configuration updates, documentation, and comprehensive tests. The check can be enabled via CLI or pre-commit configuration, and ensures commit messages use the imperative mood in their subject lines.

Changes

File(s) Change Summary
commit_check/imperatives.py Added new file containing a set of imperative verbs.
commit_check/commit.py Added imperative mood check function and helpers.
commit_check/init.py Registered the imperative check in the default configuration.
commit_check/main.py Added CLI flag and logic to invoke imperative check.
.commit-check.yml Added imperative check configuration and error/suggestion messages.
.pre-commit-hooks.yaml Added new pre-commit hook configuration for imperative check.
.pre-commit-config.yaml Added commented-out example for imperative check hook.
README.rst Updated docs to reference imperative check and usage examples.
tests/commit_test.py Added extensive tests for imperative check and its helpers.
tests/main_test.py Updated tests to include imperative check in main function testing.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant CommitCheckMain
    participant CommitCheckCommit
    participant ImperativesSet

    User->>CLI: Run commit-check --imperative -m <msg>
    CLI->>CommitCheckMain: Parse arguments
    CommitCheckMain->>CommitCheckCommit: check_imperative(checks, commit_msg_file)
    CommitCheckCommit->>ImperativesSet: Load imperative verbs
    CommitCheckCommit->>CommitCheckCommit: Analyze commit message subject
    CommitCheckCommit->>CommitCheckMain: Return PASS/FAIL
    CommitCheckMain->>CLI: Output result
Loading

Assessment against linked issues

Objective Addressed Explanation
Implement an imperative mood check for commit messages using a wordlist (verbs in imperative) (#256)
Integrate imperative mood check into CLI, config, and pre-commit hooks (#256)
Provide documentation and tests for imperative mood check (#256)

Poem

A rabbit hops, commits in style,
With verbs imperative all the while.
“Add,” “Fix,” “Build”—not “Added” or “Fixed,”
Now our messages are perfectly mixed!
🐇✨
So let us cheer this check anew,
For clear commit logs—thank you!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 41b53a9 and c005ce1.

📒 Files selected for processing (10)
  • .commit-check.yml (1 hunks)
  • .pre-commit-config.yaml (1 hunks)
  • .pre-commit-hooks.yaml (1 hunks)
  • README.rst (2 hunks)
  • commit_check/__init__.py (1 hunks)
  • commit_check/commit.py (2 hunks)
  • commit_check/imperatives.py (1 hunks)
  • commit_check/main.py (2 hunks)
  • tests/commit_test.py (2 hunks)
  • tests/main_test.py (4 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added documentation Improvements or additions to documentation enhancement New feature or request labels Jul 12, 2025
Copy link

codecov bot commented Jul 12, 2025

Codecov Report

Attention: Patch coverage is 93.61702% with 3 lines in your changes missing coverage. Please review.

Project coverage is 99.13%. Comparing base (41b53a9) to head (c005ce1).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
commit_check/commit.py 93.02% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##              main     #258      +/-   ##
===========================================
- Coverage   100.00%   99.13%   -0.87%     
===========================================
  Files            7        8       +1     
  Lines          300      347      +47     
===========================================
+ Hits           300      344      +44     
- Misses           0        3       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

codspeed-hq bot commented Jul 12, 2025

CodSpeed Performance Report

Merging #258 will degrade performances by 11.52%

Comparing feature/imperative-mood (c005ce1) with main (55b000f)

🎉 Hooray! pytest-codspeed just leveled up to 4.0.0!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

Summary

❌ 13 regressions
✅ 67 untouched benchmarks
🆕 24 new benchmarks
⁉️ 13 dropped benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 test_check_imperative_different_check_type N/A 964.3 µs N/A
🆕 test_check_imperative_empty_checks N/A 959.8 µs N/A
🆕 test_check_imperative_fail_past_tense N/A 2.6 ms N/A
🆕 test_check_imperative_fail_present_continuous N/A 2.6 ms N/A
🆕 test_check_imperative_no_commits N/A 787.2 µs N/A
🆕 test_check_imperative_pass N/A 1 ms N/A
🆕 test_check_imperative_skip_merge_commit N/A 1 ms N/A
🆕 test_is_imperative_invalid_cases N/A 186.6 µs N/A
🆕 test_is_imperative_valid_cases N/A 145.3 µs N/A
🆕 test_main[argv0-1-0-0-0-0-0] N/A 5.7 ms N/A
⁉️ test_main[argv0-1-0-0-0-0] 5.1 ms N/A N/A
🆕 test_main[argv1-0-1-0-0-0-0] N/A 5.7 ms N/A
⁉️ test_main[argv1-0-1-0-0-0] 5.1 ms N/A N/A
🆕 test_main[argv10-1-1-1-0-0-0] N/A 6.3 ms N/A
⁉️ test_main[argv10-1-1-2-0-0] 5.7 ms N/A N/A
🆕 test_main[argv11-1-1-2-0-0-0] N/A 6.3 ms N/A
⁉️ test_main[argv11-1-1-2-1-1] 6.3 ms N/A N/A
⁉️ test_main[argv12-0-0-0-0-0] 4.4 ms N/A N/A
🆕 test_main[argv12-1-1-2-1-1-0] N/A 6.9 ms N/A
🆕 test_main[argv13-1-0-0-0-0-1] N/A 6 ms N/A
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Copy link

@shenxianpeng shenxianpeng marked this pull request as ready for review July 12, 2025 21:26
@shenxianpeng shenxianpeng requested a review from a team as a code owner July 12, 2025 21:26
@shenxianpeng shenxianpeng merged commit 2b9711c into main Jul 12, 2025
25 of 28 checks passed
@shenxianpeng shenxianpeng deleted the feature/imperative-mood branch July 12, 2025 21:27
@shenxianpeng shenxianpeng added minor A minor version bump and removed documentation Improvements or additions to documentation labels Jul 12, 2025
@shenxianpeng shenxianpeng changed the title feat: add impreative mode feat: add imperative mode Jul 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor A minor version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide an imperative mood check
1 participant