releam/conventional_attributes

Types

pub type CommitType {
  Feat
  Perf
  Fix
  Refactor
  Docs
  Build
  Style
  Test
  Ci
  Chore
  Custom(String)
}

Constructors

  • Feat
  • Perf
  • Fix
  • Refactor
  • Docs
  • Build
  • Style
  • Test
  • Ci
  • Chore
  • Custom(String)
pub type ConventionalAttributes {
  ConventionalAttributes(
    commit_type: CommitType,
    scope: Option(String),
    description: String,
    body: List(String),
    footer: List(#(String, String)),
    breaking: Bool,
  )
}

Constructors

  • ConventionalAttributes(
      commit_type: CommitType,
      scope: Option(String),
      description: String,
      body: List(String),
      footer: List(#(String, String)),
      breaking: Bool,
    )
pub type ConventionalCommitParseError {
  InvalidCommitDefinition
  InvalidCommitMessage
}

Constructors

  • InvalidCommitDefinition
  • InvalidCommitMessage
pub type ConventionalDefinition {
  ConventionalDefinition(
    commit_type: CommitType,
    scope: Option(String),
    description: String,
    breaking: Bool,
  )
}

Constructors

  • ConventionalDefinition(
      commit_type: CommitType,
      scope: Option(String),
      description: String,
      breaking: Bool,
    )
pub type ConventionalFooterParseError {
  InvalidConventionalFooter
  InvalidConventionalFooterLine
}

Constructors

  • InvalidConventionalFooter
  • InvalidConventionalFooterLine
pub type ConventionalOptionalSections {
  ConventionalOptionalSections(
    body: List(String),
    footer: List(#(String, String)),
    breaking: Bool,
  )
}

Constructors

  • ConventionalOptionalSections(
      body: List(String),
      footer: List(#(String, String)),
      breaking: Bool,
    )

Functions

pub fn parse_attributes(
  message: String,
) -> Result(ConventionalAttributes, ConventionalCommitParseError)

Parses a commit message to a ConventionalAttributes record

pub fn parse_commit_type(commit_type: String) -> CommitType
pub fn parse_definition(
  def: String,
) -> Result(ConventionalDefinition, ConventionalCommitParseError)

Parses the first line of commit message to extract commit type, scope and description

pub fn parse_footer(
  raw: String,
) -> Result(List(#(String, String)), ConventionalFooterParseError)

Parses a commit message footer to a dict

pub fn parse_optional_sections(
  sections: List(String),
) -> ConventionalOptionalSections

Parses the optional lines of a commit message to extract body and footer. The list must not include the first line of a commit message

Search Document