From 14e883cac90f9c463a8751b34a414dc9e3eb7c6b Mon Sep 17 00:00:00 2001 From: Randolph Sapp Date: Thu, 11 Dec 2025 17:38:06 -0600 Subject: [PATCH 1/2] fix(subject_imperative): mixed definitions Following the documentation the old imperative check was renamed to subject_imperative. Replace all old definitions with the new name to match documented behavior. Fixes: 9f90bbd ("feat: Breaking Changes & Configuration Migration (v2 version) (#280)") Signed-off-by: Randolph Sapp --- commit_check/engine.py | 2 +- commit_check/main.py | 2 +- commit_check/rules_catalog.py | 2 +- tests/engine_comprehensive_test.py | 6 +++--- tests/engine_test.py | 10 +++++----- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/commit_check/engine.py b/commit_check/engine.py index 4a76e0e7..aaf1ea60 100644 --- a/commit_check/engine.py +++ b/commit_check/engine.py @@ -522,7 +522,7 @@ class ValidationEngine: VALIDATOR_MAP: Dict[str, Type[BaseValidator]] = { "message": CommitMessageValidator, "subject_capitalized": SubjectCapitalizationValidator, - "imperative": SubjectImperativeValidator, + "subject_imperative": SubjectImperativeValidator, "subject_max_length": SubjectLengthValidator, "subject_min_length": SubjectLengthValidator, "author_name": AuthorValidator, diff --git a/commit_check/main.py b/commit_check/main.py index c473a3ad..d1e46738 100644 --- a/commit_check/main.py +++ b/commit_check/main.py @@ -151,7 +151,7 @@ def main() -> int: requested_checks.extend( [ "message", - "imperative", + "subject_imperative", "subject_max_length", "subject_min_length", "require_signed_off_by", diff --git a/commit_check/rules_catalog.py b/commit_check/rules_catalog.py index d48d366a..e291915a 100644 --- a/commit_check/rules_catalog.py +++ b/commit_check/rules_catalog.py @@ -27,7 +27,7 @@ class RuleCatalogEntry: suggest="Capitalize the first word of the subject", ), RuleCatalogEntry( - check="imperative", + check="subject_imperative", regex=None, error="Commit message should use imperative mood (e.g., 'Add feature' not 'Added feature')", suggest="Use imperative mood in the subject line", diff --git a/tests/engine_comprehensive_test.py b/tests/engine_comprehensive_test.py index 8ce16da3..b01a8951 100644 --- a/tests/engine_comprehensive_test.py +++ b/tests/engine_comprehensive_test.py @@ -157,7 +157,7 @@ class TestSubjectImperativeValidator: def test_subject_imperative_pass(self): """Test SubjectImperativeValidator pass case.""" rule = ValidationRule( - check="imperative", + check="subject_imperative", regex="", error="Subject must be imperative", suggest="Use imperative mood", @@ -173,7 +173,7 @@ def test_subject_imperative_pass(self): def test_subject_imperative_fail(self): """Test SubjectImperativeValidator fail case.""" rule = ValidationRule( - check="imperative", + check="subject_imperative", regex="", error="Subject must be imperative", suggest="Use imperative mood", @@ -247,7 +247,7 @@ def test_validation_engine_validator_map(self): expected_mappings = { "message": CommitMessageValidator, "subject_capitalized": SubjectCapitalizationValidator, - "imperative": SubjectImperativeValidator, + "subject_imperative": SubjectImperativeValidator, "subject_max_length": SubjectLengthValidator, "subject_min_length": SubjectLengthValidator, "author_name": AuthorValidator, diff --git a/tests/engine_test.py b/tests/engine_test.py index 81e714c6..416b5785 100644 --- a/tests/engine_test.py +++ b/tests/engine_test.py @@ -870,7 +870,7 @@ class TestSubjectImperativeValidator: @pytest.mark.benchmark def test_validate_with_imperative_subject(self): """Test validation with proper imperative subject.""" - rule = ValidationRule(check="imperative") + rule = ValidationRule(check="subject_imperative") validator = SubjectImperativeValidator(rule) context = ValidationContext(stdin_text="fix: resolve the issue") @@ -880,7 +880,7 @@ def test_validate_with_imperative_subject(self): @pytest.mark.benchmark def test_validate_with_non_imperative_subject(self): """Test validation with non-imperative subject.""" - rule = ValidationRule(check="imperative") + rule = ValidationRule(check="subject_imperative") validator = SubjectImperativeValidator(rule) context = ValidationContext(stdin_text="fix: resolved the issue") @@ -892,7 +892,7 @@ def test_validate_with_non_imperative_subject(self): @pytest.mark.benchmark def test_validate_short_subject(self): """Test validation with very short subject (edge case).""" - rule = ValidationRule(check="imperative") + rule = ValidationRule(check="subject_imperative") validator = SubjectImperativeValidator(rule) context = ValidationContext(stdin_text="feat: add") @@ -903,7 +903,7 @@ def test_validate_short_subject(self): @pytest.mark.benchmark def test_validate_with_breaking_change(self): """Test validation with breaking change notation.""" - rule = ValidationRule(check="imperative") + rule = ValidationRule(check="subject_imperative") validator = SubjectImperativeValidator(rule) context = ValidationContext(stdin_text="feat!: update authentication system") @@ -914,7 +914,7 @@ def test_validate_with_breaking_change(self): @pytest.mark.benchmark def test_validate_with_scoped_breaking_change(self): """Test validation with scoped breaking change notation.""" - rule = ValidationRule(check="imperative") + rule = ValidationRule(check="subject_imperative") validator = SubjectImperativeValidator(rule) context = ValidationContext(stdin_text="fix(auth)!: resolve login bug") From 19280cb1c83c2cc771a6804502b841a6574712a7 Mon Sep 17 00:00:00 2001 From: Randolph Sapp Date: Tue, 16 Dec 2025 17:47:33 -0600 Subject: [PATCH 2/2] ci(main): do not ref pin when checking prs Ref pinning will incorrectly try to check out the branch name on the project origin, not the pull request origin. Fixes: 6a7a35c ("feat: inital commit") Signed-off-by: Randolph Sapp --- .github/workflows/main.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bbf844af..efced516 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,8 +21,6 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - with: - ref: ${{ github.head_ref }} # get current branch name - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 with: python-version: '3.x' @@ -89,8 +87,6 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6.0.1 - with: - ref: ${{ github.head_ref }} # get current branch name - uses: actions/setup-python@v6.1.0 with: python-version: "3.10"