Skip to content
Back to top
View this page

# semantic_release.commit_parser.conventional.parser module

class semantic_release.commit_parser.conventional.parser.ConventionalCommitParser(options: ConventionalCommitParserOptions | None = None)

  Bases: `CommitParser`[`ParsedCommit` | `ParseError`, `ConventionalCommitParserOptions`]

  A commit parser for projects conforming to the conventional commits specification.

  See https://www.conventionalcommits.org/en/v1.0.0/

  commit_body_components_separator(accumulator: dict[str, list[str]], text: str) → dict[str, list[str]]
  common_commit_msg_filters: ClassVar[dict[str, tuple[Pattern[str], str]]] = {'git-header-author': (re.compile('^[\\t ]*Author: .+$\\n?', re.MULTILINE), ''), 'git-header-commit': (re.compile('^[\\t ]*commit [0-9a-f]+$\\n?', re.MULTILINE), ''), 'git-header-date': (re.compile('^[\\t ]*Date: .+$\\n?', re.MULTILINE), ''), 'git-squash-heading': (re.compile('^[\\t ]*Squashed commit of the following:.*$\\n?', re.MULTILINE), ''), 'typo-extra-spaces': (re.compile('(\\S) +(\\S)'), '\\1 \\2')}
  create_parsed_message_result(match: Match[str]) → ParsedMessageResult
  get_default_options() → ConventionalCommitParserOptions
  static is_merge_commit(commit: Commit) → bool
  issue_selector = re.compile('^(?:clos(?:e|es|ed|ing)|fix(?:es|ed|ing)?|resolv(?:e|es|ed|ing)|implement(?:s|ed|ing)?):[\\t ]+(?P<issue_predicate>.+)[\\t ]*$', re.IGNORECASE|re.MULTILINE)
  log_parse_error(commit: Commit, error: str) → ParseError
  mr_selector = re.compile('[\\t ]+\\((?:pull request )?(?P<mr_number>[#!]\\d+)\\)[\\t ]*$')
  notice_selector = re.compile('^NOTICE: (?P<notice>.+)$')
  parse(commit: Commit) → ParsedCommit | ParseError | list[ParsedCommit | ParseError]

    Parse a commit message

    If the commit message is a squashed merge commit, it will be split into multiple commits, each of which will be parsed separately. Single commits will be returned as a list of a single ParseResult.

  parse_commit(commit: Commit) → ParsedCommit | ParseError
  parse_message(message: str) → ParsedMessageResult | None
  parser_options

    alias of `ConventionalCommitParserOptions`

  unsquash_commit(commit: Commit) → list[Commit]
  unsquash_commit_message(message: str) → list[str]