generate_changelog.release_hint.ReleaseRule

ReleaseRule#

class generate_changelog.release_hint.ReleaseRule[source]#

A commit evaluation rule for hinting at the level of change.

Parameters:
  • match_result (Optional[str]) – Release type if a commit context matches the rule.

  • no_match_result (Optional[str]) – Release type if a commit context doesn’t match the rule.

  • grouping (Union[str, tuple, list, None]) – The partial or exact grouping of the commit context

  • path (Optional[str]) – A globbing pattern that matches against files included in the commit

  • branch (Optional[str]) – A regular expression pattern to match against the branch

__init__(match_result, no_match_result='no-release', grouping=None, path=None, branch=None)[source]#
Parameters:
  • match_result (str | None) –

  • no_match_result (str | None) –

  • grouping (str | tuple | list | None) –

  • path (str | None) –

  • branch (str | None) –

matches_grouping(commit)[source]#

Does the commit grouping match the rule?

  • If self.grouping is a string, it checks if the string is in the commit’s grouping.

  • If self.grouping is a list or tuple of strings, it must match the commit’s grouping.

  • 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’s grouping.

  • If self.grouping is None, it will return a match

Parameters:

commit (CommitContext) – The commit context whose grouping should match

Return type:

bool

Returns:

True if the grouping matches

matches_path(commit)[source]#

Do any of the paths in the commit match the rule?

Parameters:

commit (CommitContext) – The commit context whose files should match

Return type:

bool

Returns:

True if any file in the commit context matches the pattern or if self.path is None

matches_branch(current_branch)[source]#

Does the current branch match the rule?

Parameters:

current_branch (str) – The name of the current branch

Return type:

bool

Returns:

True if the current branch matches or if self.branch is None

__call__(commit, current_branch)[source]#

Evaluate the commit using this rule.

Return type:

Optional[str]

Parameters: