Skip to content

Latest commit

 

History

History
53 lines (38 loc) · 2.72 KB

rules.md

File metadata and controls

53 lines (38 loc) · 2.72 KB

Validation Rules

CommitIt validates against the following sets of specifications:

Conventional Commits

Identifier Description
CC-01 Commits MUST be prefixed with a type, which consists of a noun, feat, fix, etc., followed by the OPTIONAL scope, OPTIONAL !, and REQUIRED terminal colon and space.
CC-04 A scope MAY be provided after a type. A scope MUST consist of a noun describing a section of the codebase surrounded by parenthesis, e.g., fix(parser):
CC-05 A description MUST immediately follow the colon and space after the type/scope prefix. The description is a short summary of the code changes, e.g., fix: array parsing issue when multiple spaces were contained in string.
CC-06 A longer commit body MAY be provided after the short description, providing additional contextual information about the code changes. The body MUST begin one blank line after the description.
CC-15 The units of information that make up Conventional Commits MUST NOT be treated as case sensitive by implementors, with the exception of BREAKING CHANGE which MUST be uppercase.

NOTE: Above 3 requirements are covered by 12 distinct validation rules

Extended Conventional Commits specification

Identifier Description
EC-01 A scope MAY be provided after a type. A scope MUST consist of one of the configured values (...) surrounded by parenthesis
EC-02 Commits MUST be prefixed with a type, which consists of one of the configured values (feat, fix, ...)

You can provide the mentioned configuration options as follows:

const conventionalOptions = {
  // EC-01: A scope MAY be provided after a type. A scope MUST consist of one of the configured values (...) surrounded by parenthesis
  scopes: [ "core", "cli", "action" ],

  // EC-02: Commits MUST be prefixed with a type, which consists of one of the configured values (...)
  types: [ "build", "ci", "docs", "perf", "refactor", "style", "test" ],
}

const conventionalCommit = getConventionalCommit(gitCommit, conventionalOptions);

Additional warnings

In order to warn users about edge cases, several warning messages have been introduced to prevent unwanted behavior:

Identifier Description
WA-01 A BREAKING CHANGE git-trailer has been found in the body of the commit message and will be ignored as it MUST be included in the footer.