Skip to content

test: add test coverage for positional commit_msg_file argument#367

Merged
shenxianpeng merged 2 commits intofix/add-commit-msg-filefrom
copilot/sub-pr-366
Feb 3, 2026
Merged

test: add test coverage for positional commit_msg_file argument#367
shenxianpeng merged 2 commits intofix/add-commit-msg-filefrom
copilot/sub-pr-366

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

The positional commit_msg_file argument added in PR #366 lacked explicit test coverage for its core use cases and edge cases.

Changes

Added test class TestPositionalArgumentFeature with 5 tests covering:

  • Positional argument alone: commit-check .git/COMMIT_EDITMSG auto-enables message validation
  • With --message flag: commit-check --message .git/COMMIT_EDITMSG works correctly
  • With other flags: commit-check --branch .git/COMMIT_EDITMSG validates both
  • Invalid messages: Properly rejects non-conformant commits via positional arg
  • Missing file: Falls back to git when file doesn't exist

All tests follow existing patterns using @pytest.mark.benchmark decorator and proper mocking of git operations.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 3, 2026

Copilot AI changed the title [WIP] Fix commit message file argument support for pre-commit test: add test coverage for positional commit_msg_file argument Feb 3, 2026
Copilot AI requested a review from shenxianpeng February 3, 2026 01:14
@shenxianpeng shenxianpeng marked this pull request as ready for review February 3, 2026 01:15
@shenxianpeng shenxianpeng requested a review from a team as a code owner February 3, 2026 01:15
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.65%. Comparing base (e593590) to head (ec3aacb).
⚠️ Report is 1 commits behind head on fix/add-commit-msg-file.

Additional details and impacted files
@@                     Coverage Diff                     @@
##           fix/add-commit-msg-file     #367      +/-   ##
===========================================================
+ Coverage                    94.40%   94.65%   +0.24%     
===========================================================
  Files                            9        9              
  Lines                          805      805              
===========================================================
+ Hits                           760      762       +2     
+ Misses                          45       43       -2     

☔ 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.

@shenxianpeng shenxianpeng merged commit 8adb4db into fix/add-commit-msg-file Feb 3, 2026
27 checks passed
@shenxianpeng shenxianpeng deleted the copilot/sub-pr-366 branch February 3, 2026 01:15
shenxianpeng added a commit that referenced this pull request Feb 3, 2026
* feat: add support for commit message file argument for pre-commit compatibility

* fix: refactor commit message handling

* fix: accept both hyphen and underscore formats for CLI args

* Revert "fix: accept both hyphen and underscore formats for CLI args"

This reverts commit 732bbda.

* fix: Update commit_check/main.py per review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* test: add test coverage for positional commit_msg_file argument (#367)

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants