Skip to content

规则

¥Rules

body-case

  • 条件:body 位于 value 的 case 中

    ¥condition: body is in case value

  • 规则:always

    ¥rule: always

  • value

    text
    'lower-case'
  • 可能的值

    ¥possible values

    js
    [
      "lower-case", // default
      "upper-case", // UPPERCASE
      "camel-case", // camelCase
      "kebab-case", // kebab-case
      "pascal-case", // PascalCase
      "sentence-case", // Sentence case
      "snake-case", // snake_case
      "start-case", // Start Case
    ];

body-empty

  • 条件:body 为空

    ¥condition: body is empty

  • 规则:never

    ¥rule: never

body-full-stop

  • 条件:bodyvalue 结尾

    ¥condition: body ends with value

  • 规则:never

    ¥rule: never

  • value

    text
    '.'

body-leading-blank

  • 条件:body 以空行开头

    ¥condition: body begins with blank line

  • 规则:always

    ¥rule: always

body-max-length

  • 条件:body 包含 value 个或更少个字符

    ¥condition: body has value or less characters

  • 规则:always

    ¥rule: always

  • value

    text
    Infinity

body-max-line-length

  • 条件:body 行的字符数不超过 value,或者包含 URL

    ¥condition: body lines have value or less characters, or contain a URL

  • 规则:always

    ¥rule: always

  • value

    text
    Infinity

body-min-length

  • 条件:body 包含 value 个或更多个字符

    ¥condition: body has value or more characters

  • 规则:always

    ¥rule: always

  • value

    text
    0

breaking-change-exclamation-mark

  • 条件:如果 header: 标记前有感叹号,且 footer 中的某一行匹配正则表达式 ^BREAKING[ -]CHANGE:,则此配置失败。

    ¥condition: Either both or neither header has an exclamation mark before the : marker and a line in footer matches the regular expression ^BREAKING[ -]CHANGE:

  • 规则:always

    ¥rule: always

NOTE

此规则强制要求在提交头中使用 !,在提交尾中使用 BREAKING CHANGE 来标记重大更改。此配置的行为类似于异或 (XNOR) 运算:

¥This rule enforces that breaking changes are marked by both a ! in the header and BREAKING CHANGE in the footer. The behavior is that of an XNOR operation:

  • 如果满足两个条件之一或两个条件都不满足,则此配置通过。

    ¥It passes when either both are present or both are not.

  • 如果满足其中一个条件而另一个条件不满足,则此配置失败。

    ¥It fails when one is present and the other is not.

  • 条件:footer 为空

    ¥condition: footer is empty

  • 规则:never

    ¥rule: never

  • 条件:footer 以空行开头

    ¥condition: footer begins with blank line

  • 规则:always

    ¥rule: always

  • 条件:footer 包含 value 个或更少个字符

    ¥condition: footer has value or less characters

  • 规则:always

    ¥rule: always

  • value

    text
    Infinity
  • 条件:footer 行的字符数不超过 value

    ¥condition: footer lines have value or less characters

  • 规则:always

    ¥rule: always

  • value

    text
    Infinity
  • 条件:footer 包含 value 个或更多个字符

    ¥condition: footer has value or more characters

  • 规则:always

    ¥rule: always

  • value

    text
    0

header-case

  • 条件:header 位于 value 的 case 中

    ¥condition: header is in case value

  • 规则:always

    ¥rule: always

  • value

    text
    'lower-case'
  • 可能的值

    ¥possible values

    js
    [
      "lower-case", // default
      "upper-case", // UPPERCASE
      "camel-case", // camelCase
      "kebab-case", // kebab-case
      "pascal-case", // PascalCase
      "sentence-case", // Sentence case
      "snake-case", // snake_case
      "start-case", // Start Case
    ];

header-full-stop

  • 条件:headervalue 结尾

    ¥condition: header ends with value

  • 规则:never

    ¥rule: never

  • value

    text
    '.'

header-max-length

  • 条件:header 包含 value 个或更少个字符

    ¥condition: header has value or less characters

  • 规则:always

    ¥rule: always

  • value

    text
    72

header-min-length

  • 条件:header 包含 value 个或更多个字符

    ¥condition: header has value or more characters

  • 规则:always

    ¥rule: always

  • value

    text
    0

header-trim

  • 条件:header 行的开头和结尾不得有空格

    ¥condition: header must not have initial or trailing whitespaces

  • 规则:always

    ¥rule: always

references-empty

  • 条件:references 至少包含一个条目

    ¥condition: references has at least one entry

  • 规则:never

    ¥rule: never

scope-case

  • 条件:scope 位于 value 的 case 中

    ¥condition: scope is in case value

  • 规则:always

    ¥rule: always

  • value

    text
    'lower-case'
  • 可能的值

    ¥possible values

    js
    [
      "lower-case", // default
      "upper-case", // UPPERCASE
      "camel-case", // camelCase
      "kebab-case", // kebab-case
      "pascal-case", // PascalCase
      "sentence-case", // Sentence case
      "snake-case", // snake_case
      "start-case", // Start Case
    ];

scope-empty

  • 条件:scope 为空

    ¥condition: scope is empty

  • 规则:never

    ¥rule: never

scope-enum

  • 条件:scope 位于值中

    ¥condition: scope is found in value

  • 规则:always

    ¥rule: always

  • value

    text
    []

NOTE

  • 如果消息中未提供作用域或值 > 为空数组,则此规则始终有效。

    ¥This rule always passes if no scopes are provided in the message or the value > is an empty array.

  • 设置为 always 时,所有消息范围都必须在值中找到。

    ¥When set to always, all message scopes must be found in the value.

  • 设置为 never 时,任何消息范围都无法在值中找到。

    ¥When set to never, none of the message scopes can be found in the value.

scope-max-length

  • 条件:scope 包含 value 个或更少个字符

    ¥condition: scope has value or less characters

  • 规则:always

    ¥rule: always

  • value

    text
    Infinity

scope-min-length

  • 条件:scope 包含 value 个或更多个字符

    ¥condition: scope has value or more characters

  • 规则:always

    ¥rule: always

  • value

    text
    0

signed-off-by

  • 条件:message 包含 value

    ¥condition: message has value

  • 规则:always

    ¥rule: always

  • value

    text
    'Signed-off-by:'

subject-case

  • 条件:subject 位于 value 的 case 中

    ¥condition: subject is in case value

  • 规则:always

    ¥rule: always

  • value

    js
    ["sentence-case", "start-case", "pascal-case", "upper-case"];
  • 可能的值

    ¥possible values

    js
    [
      "lower-case", // lower case
      "upper-case", // UPPERCASE
      "camel-case", // camelCase
      "kebab-case", // kebab-case
      "pascal-case", // PascalCase
      "sentence-case", // Sentence case
      "snake-case", // snake_case
      "start-case", // Start Case
    ];

subject-empty

  • 条件:subject 为空

    ¥condition: subject is empty

  • 规则:never

    ¥rule: never

subject-exclamation-mark

  • 条件:subject: 标记前有一个感叹号

    ¥condition: subject has exclamation before the : marker

  • 规则:never

    ¥rule: never

subject-full-stop

  • 条件:subjectvalue 结尾

    ¥condition: subject ends with value

  • 规则:never

    ¥rule: never

  • value

    text
    '.'

subject-max-length

  • 条件:subject 包含 value 个或更少个字符

    ¥condition: subject has value or less characters

  • 规则:always

    ¥rule: always

  • value

    text
    Infinity

subject-min-length

  • 条件:subject 包含 value 个或更多个字符

    ¥condition: subject has value or more characters

  • 规则:always

    ¥rule: always

  • value

    text
    0

trailer-exists

  • 条件:message 包含尾随 value

    ¥condition: message has trailer value

  • 规则:always

    ¥rule: always

  • value

    text
    'Signed-off-by:'

type-case

  • 描述:type 位于 value 的 case 中

    ¥description: type is in case value

  • 规则:always

    ¥rule: always

  • value

    text
    'lower-case'
  • 可能的值

    ¥possible values

    js
    [
      "lower-case", // default
      "upper-case", // UPPERCASE
      "camel-case", // camelCase
      "kebab-case", // kebab-case
      "pascal-case", // PascalCase
      "sentence-case", // Sentence case
      "snake-case", // snake_case
      "start-case", // Start Case
    ];

type-empty

  • 条件:type 为空

    ¥condition: type is empty

  • 规则:never

    ¥rule: never

type-enum

  • 条件:type 位于值中

    ¥condition: type is found in value

  • 规则:always

    ¥rule: always

  • value

    js
    [
      "build",
      "chore",
      "ci",
      "docs",
      "feat",
      "fix",
      "perf",
      "refactor",
      "revert",
      "style",
      "test",
    ];

type-max-length

  • 条件:type 包含 value 个或更少个字符

    ¥condition: type has value or less characters

  • 规则:always

    ¥rule: always

  • value

    text
    Infinity

type-min-length

  • 条件:type 包含 value 个或更多个字符

    ¥condition: type has value or more characters

  • 规则:always

    ¥rule: always

  • value

    text
    0