Skip to content

Commit bcbe201

Browse files
StaticRocketshenxianpeng
authored andcommitted
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 <rs@ti.com>
1 parent 996758d commit bcbe201

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

commit_check/engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ class ValidationEngine:
522522
VALIDATOR_MAP: Dict[str, Type[BaseValidator]] = {
523523
"message": CommitMessageValidator,
524524
"subject_capitalized": SubjectCapitalizationValidator,
525-
"imperative": SubjectImperativeValidator,
525+
"subject_imperative": SubjectImperativeValidator,
526526
"subject_max_length": SubjectLengthValidator,
527527
"subject_min_length": SubjectLengthValidator,
528528
"author_name": AuthorValidator,

commit_check/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def main() -> int:
151151
requested_checks.extend(
152152
[
153153
"message",
154-
"imperative",
154+
"subject_imperative",
155155
"subject_max_length",
156156
"subject_min_length",
157157
"require_signed_off_by",

commit_check/rules_catalog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class RuleCatalogEntry:
2727
suggest="Capitalize the first word of the subject",
2828
),
2929
RuleCatalogEntry(
30-
check="imperative",
30+
check="subject_imperative",
3131
regex=None,
3232
error="Commit message should use imperative mood (e.g., 'Add feature' not 'Added feature')",
3333
suggest="Use imperative mood in the subject line",

tests/engine_comprehensive_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class TestSubjectImperativeValidator:
157157
def test_subject_imperative_pass(self):
158158
"""Test SubjectImperativeValidator pass case."""
159159
rule = ValidationRule(
160-
check="imperative",
160+
check="subject_imperative",
161161
regex="",
162162
error="Subject must be imperative",
163163
suggest="Use imperative mood",
@@ -173,7 +173,7 @@ def test_subject_imperative_pass(self):
173173
def test_subject_imperative_fail(self):
174174
"""Test SubjectImperativeValidator fail case."""
175175
rule = ValidationRule(
176-
check="imperative",
176+
check="subject_imperative",
177177
regex="",
178178
error="Subject must be imperative",
179179
suggest="Use imperative mood",
@@ -247,7 +247,7 @@ def test_validation_engine_validator_map(self):
247247
expected_mappings = {
248248
"message": CommitMessageValidator,
249249
"subject_capitalized": SubjectCapitalizationValidator,
250-
"imperative": SubjectImperativeValidator,
250+
"subject_imperative": SubjectImperativeValidator,
251251
"subject_max_length": SubjectLengthValidator,
252252
"subject_min_length": SubjectLengthValidator,
253253
"author_name": AuthorValidator,

tests/engine_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ class TestSubjectImperativeValidator:
811811
@pytest.mark.benchmark
812812
def test_validate_with_imperative_subject(self):
813813
"""Test validation with proper imperative subject."""
814-
rule = ValidationRule(check="imperative")
814+
rule = ValidationRule(check="subject_imperative")
815815
validator = SubjectImperativeValidator(rule)
816816
context = ValidationContext(stdin_text="fix: resolve the issue")
817817

@@ -821,7 +821,7 @@ def test_validate_with_imperative_subject(self):
821821
@pytest.mark.benchmark
822822
def test_validate_with_non_imperative_subject(self):
823823
"""Test validation with non-imperative subject."""
824-
rule = ValidationRule(check="imperative")
824+
rule = ValidationRule(check="subject_imperative")
825825
validator = SubjectImperativeValidator(rule)
826826
context = ValidationContext(stdin_text="fix: resolved the issue")
827827

@@ -833,7 +833,7 @@ def test_validate_with_non_imperative_subject(self):
833833
@pytest.mark.benchmark
834834
def test_validate_short_subject(self):
835835
"""Test validation with very short subject (edge case)."""
836-
rule = ValidationRule(check="imperative")
836+
rule = ValidationRule(check="subject_imperative")
837837
validator = SubjectImperativeValidator(rule)
838838
context = ValidationContext(stdin_text="feat: add")
839839

@@ -844,7 +844,7 @@ def test_validate_short_subject(self):
844844
@pytest.mark.benchmark
845845
def test_validate_with_breaking_change(self):
846846
"""Test validation with breaking change notation."""
847-
rule = ValidationRule(check="imperative")
847+
rule = ValidationRule(check="subject_imperative")
848848
validator = SubjectImperativeValidator(rule)
849849
context = ValidationContext(stdin_text="feat!: update authentication system")
850850

@@ -855,7 +855,7 @@ def test_validate_with_breaking_change(self):
855855
@pytest.mark.benchmark
856856
def test_validate_with_scoped_breaking_change(self):
857857
"""Test validation with scoped breaking change notation."""
858-
rule = ValidationRule(check="imperative")
858+
rule = ValidationRule(check="subject_imperative")
859859
validator = SubjectImperativeValidator(rule)
860860
context = ValidationContext(stdin_text="fix(auth)!: resolve login bug")
861861

0 commit comments

Comments
 (0)