Skip to content

Commit deae807

Browse files
committed
docs(bump_rule): docstring
1 parent be7cb23 commit deae807

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

commitizen/bump_rule.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,26 @@ def find_increment_by_callable(
4343
class BumpRule(Protocol):
4444
def get_increment(
4545
self, commit_message: str, major_version_zero: bool
46-
) -> Increment | None: ...
46+
) -> Increment | None:
47+
"""Determine the version increment based on a commit message.
48+
49+
This method analyzes a commit message to determine what kind of version increment
50+
is needed according to the Conventional Commits specification. It handles special
51+
cases for breaking changes and respects the major_version_zero flag.
52+
53+
Args:
54+
commit_message: The commit message to analyze. Should follow conventional commit format.
55+
major_version_zero: If True, breaking changes will result in a MINOR version bump
56+
instead of MAJOR. This is useful for projects in 0.x.x versions.
57+
58+
Returns:
59+
Increment | None: The type of version increment needed:
60+
- "MAJOR": For breaking changes when major_version_zero is False
61+
- "MINOR": For breaking changes when major_version_zero is True, or for new features
62+
- "PATCH": For bug fixes, performance improvements, or refactors
63+
- None: For commits that don't require a version bump (docs, style, etc.)
64+
"""
65+
...
4766

4867

4968
class ConventionalCommitBumpRule(BumpRule):

0 commit comments

Comments
 (0)