Class CommitMessageConvention


  • public class CommitMessageConvention
    extends Object
    This object models the fields used to configure a generic commit message convention.
    The regular expression associated with this object is important and needs to define the following named capturing groups:
    - type yields to the commit message type (if any)
    - scope yields to the commit message scope (if any)
    - title yields to the commit message title (the short, 1 line, description of the commit)

    The bump regular expressions provided with this object are used to determine if a commit message is meant to bump a version identifier. Each entry in the map has a version identifier as the key and a regular expression as the value. When the regular expression in the value matches the commit message then the identifier in the key has to be bumped. These regular expressions are evaluated simply, just match or no-match, without named groups etc. The order of the entries does not matter as in case of multiple matches only the most significant identifier is bumped. Identifier names depend on the versioning Scheme in use.
    • Constructor Detail

      • CommitMessageConvention

        public CommitMessageConvention()
        Default constructor.
      • CommitMessageConvention

        public CommitMessageConvention​(String expression,
                                       Map<String,​String> bumpExpressions)
        Standard constructor.
        Parameters:
        expression - the regular expression used to parse informations from a commit message. It must comply with the requirements define on top of this class documentation.
        bumpExpressions - the map where each key is a version identifier to bump and the value is a regular expression to be evaluated against the commit message. When the expression matches the commit message the version identifier in the key is to be bumped. It must comply with the requirements define on top of this class documentation.
    • Method Detail

      • getExpression

        public String getExpression()
        Returns the regular expression used to parse informations from a commit message.
        Returns:
        the regular expression used to parse informations from a commit message.
      • setExpression

        public void setExpression​(String expression)
        Sets the regular expression used to parse informations from a commit message.
        Parameters:
        expression - the regular expression used to parse informations from a commit message.
      • getBumpExpressions

        public Map<String,​String> getBumpExpressions()
        Returns the map where each key is a version identifier to bump and the value is a regular expression to be evaluated against the commit message. When the expression matches the commit message the version identifier in the key is to be bumped.
        Returns:
        the map where each key is a version identifier to bump and the value is a regular expression to be evaluated against the commit message. Never null but may be empty.