Class CommitMessageParser

java.lang.Object
io.github.joke.conventionalversion.calc.CommitMessageParser

public class CommitMessageParser extends Object
Extracts the version-relevant facts from a raw commit message.

Only what the calculation needs is parsed: a description, a footer map and commit references would all be dead weight in a component that never renders a changelog.

  • Constructor Details

    • CommitMessageParser

      public CommitMessageParser()
  • Method Details

    • parse

      public ConventionalCommit parse(String message)
    • headerOf

      @VisibleForTesting protected String headerOf(String message)
    • isBreaking

      @VisibleForTesting protected boolean isBreaking(@Nullable String breakingMarker, String message)
      Whether the commit declares a breaking change, by either spelling the specification allows.
      Parameters:
      breakingMarker - the ! captured from the header, or null when absent
    • findReleaseAs

      @VisibleForTesting protected Optional<SemanticVersion> findReleaseAs(String message)
      The last footer in the message wins, matching release-please's handling of repeated overrides.