Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:status: new

Changelog
=========

Expand Down
3 changes: 3 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:status: new

Configuration
=============

Expand All @@ -18,6 +20,7 @@ Example Configuration
---------------------

.. code-block:: toml
:class: copy

[commit]
# https://www.conventionalcommits.org
Expand Down
2 changes: 2 additions & 0 deletions docs/migration.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:status: new

Migration Guide
===============

Expand Down
2 changes: 2 additions & 0 deletions docs/what-is-new.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:status: new

What's New
==========

Expand Down
11 changes: 9 additions & 2 deletions tests/engine_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,15 @@ def test_commit_message_validator_with_file(self):
finally:
os.unlink(f.name)

def test_commit_message_validator_file_not_found(self):
@patch("commit_check.engine.get_commit_info")
def test_commit_message_validator_file_not_found(self, mock_get_commit_info):
"""Test CommitMessageValidator with non-existent file."""
# Mock git fallback to return a message that doesn't match regex
mock_get_commit_info.side_effect = lambda format_str: {
"s": "invalid commit message",
"b": "",
}[format_str]

rule = ValidationRule(check="message", regex=r"^feat:")
validator = CommitMessageValidator(rule)
context = ValidationContext(commit_file="/nonexistent/file")
Expand Down Expand Up @@ -123,7 +130,7 @@ def test_commit_message_validator_from_git(self, mock_get_commit_info):


class TestBranchValidator:
@patch("commit_check.util.get_branch_name")
@patch("commit_check.engine.get_branch_name")
def test_branch_validator_valid_branch(self, mock_get_branch_name):
"""Test BranchValidator with valid branch name."""
mock_get_branch_name.return_value = "feature/new-feature"
Expand Down
Loading