release_hint
Methods for generating a release hint.
CLASS | DESCRIPTION |
---|---|
InvalidRuleError |
The evaluated rule is invalid. |
ReleaseRule |
A commit evaluation rule for hinting at the level of change. |
ReleaseRuleResult |
The result of evaluating a release rule. |
RuleProcessor |
Process a commit through all the rules and return the suggestion. |
FUNCTION | DESCRIPTION |
---|---|
format_bool |
Format a boolean value as a string. |
get_commit_results |
Return the contents of the commit results table. |
output_report |
Output the release hint report. |
print_table |
Print the test results as a table. |
suggest_release_type |
Suggest the type of release based on the unreleased commits. |
Attributes¶
Classes¶
ReleaseRule
¶
ReleaseRule(
id_: int,
match_result: Optional[str],
no_match_result: Optional[str] = "no-release",
grouping: Union[str, tuple, list, None] = None,
path: Optional[Union[str, Sequence[str]]] = None,
branch: Optional[str] = None,
)
A commit evaluation rule for hinting at the level of change.
PARAMETER | DESCRIPTION |
---|---|
id_
|
The id of this rule. Used for debugging.
TYPE:
|
match_result
|
Release type if a commit context matches the rule. |
no_match_result
|
Release type if a commit context doesn’t match the rule. |
grouping
|
The partial or exact grouping of the commit context |
path
|
A globbing pattern that matches against files included in the commit |
branch
|
A regular expression pattern to match against the branch |
METHOD | DESCRIPTION |
---|---|
__call__ |
Evaluate the commit using this rule. |
matches_branch |
Does the current branch match the rule? |
matches_grouping |
Does the commit grouping match the rule? |
matches_path |
Do any of the paths in the commit match the rule? |
Functions¶
__call__
¶
__call__(commit: CommitContext, current_branch: str) -> ReleaseRuleResult
Evaluate the commit using this rule.
matches_branch
¶
matches_grouping
¶
matches_grouping(commit: CommitContext) -> bool
Does the commit grouping match the rule?
- If
self.grouping
is a string, it checks if the string is in the commit’sgrouping
.
- If
self.grouping
is a list or tuple of strings, it must match the commit’sgrouping
.
- If
self.grouping
is a list or tuple of strings and the last item in the list is a “*”, it must match the beginning of the commit’sgrouping
.
- If
self.grouping
is None, it will return a match
PARAMETER | DESCRIPTION |
---|---|
commit
|
The commit context whose grouping should match
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
bool
|
|
matches_path
¶
matches_path(commit: CommitContext) -> bool
Do any of the paths in the commit match the rule?
PARAMETER | DESCRIPTION |
---|---|
commit
|
The commit context whose files should match
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
bool
|
|
ReleaseRuleResult
dataclass
¶
ReleaseRuleResult(
rule_id: int,
commit: str,
matches_grouping: bool,
matches_path: bool,
matches_branch: bool,
result: str,
)
The result of evaluating a release rule.
ATTRIBUTE | DESCRIPTION |
---|---|
matches_all |
All the commit criteria were met.
TYPE:
|
RuleProcessor
¶
Process a commit through all the rules and return the suggestion.
PARAMETER | DESCRIPTION |
---|---|
rule_list
|
The list of dictionaries representing release rules |
METHOD | DESCRIPTION |
---|---|
__call__ |
Return the result of applying all the rules to a commit. |
rule_string |
Return a string representation of the rules. |
Functions¶
__call__
¶
__call__(commit: CommitContext, current_branch: str) -> Optional[str]
Return the result of applying all the rules to a commit.
PARAMETER | DESCRIPTION |
---|---|
commit
|
The commit context to apply rules to
TYPE:
|
current_branch
|
The name of the current branch
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[str]
|
The release hint |
Functions¶
get_commit_results
¶
get_commit_results(
results: List[ReleaseRuleResult],
) -> Iterable[RenderableType]
Return the contents of the commit results table.
output_report
¶
Output the release hint report.
print_table
¶
Print the test results as a table.
suggest_release_type
¶
suggest_release_type(
current_branch: str,
version_contexts: List[VersionContext],
config: Configuration,
) -> str
Suggest the type of release based on the unreleased commits.
PARAMETER | DESCRIPTION |
---|---|
current_branch
|
The name of the current branch
TYPE:
|
version_contexts
|
The processed commits to process
TYPE:
|
config
|
The current configuration
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
The type of release based on the rules, or |