logo
1
0
WeChat Login

commitlint

Based on conventional commit specification, check if commit messages comply with the given rules.

Configuration Method

Place custom configuration files in the project root directory. For configuration file search priority, refer to the official documentation

  • .commitlintrc
  • .commitlintrc.json
  • .commitlintrc.yaml
  • .commitlintrc.yml
  • .commitlintrc.js
  • .commitlintrc.cjs
  • .commitlintrc.mjs
  • .commitlintrc.ts
  • .commitlintrc.cts
  • commitlint.config.js
  • commitlint.config.cjs
  • commitlint.config.mjs
  • commitlint.config.ts
  • commitlint.config.cts

When this configuration is not added, the following default configuration will be used:

# Default .commitlintrc.yml configuration
extends:
  - "@commitlint/config-conventional"

The following plugins are supported by default:

  • @commitlint/config-conventional
  • commitlint-plugin-references

Conventional Commits

Consistent with open source community standards, see https://www.conventionalcommits.org/

Usage in Cloud Native Build

# The plugin uses git command internally to get commit messages, no need to pass commit messages
main:
  pull_request:
  - stages:
    - name: commitlint
      image: cnbcool/commitlint

Allow Chinese

#.commitlintrc.yml

extends:
  - "@commitlint/config-conventional"

rules:
  #Allow Chinese
  subject-case: [0]

Require Issue References in Commit Messages

Use the following configuration to require issue numbers starting with # in commit messages.

#.commitlintrc.yml

extends:
  - "@commitlint/config-conventional"

parserPreset:
  parserOpts:
    # issues start with #
    issuePrefixes: ["#"]

rules:
  #Allow Chinese
  subject-case: [0]
  #Must have issue references
  references-empty: [2, 'never']

Enable Reference Validation for Specific Types Only

#.commitlintrc.yml

extends:
  - "@commitlint/config-conventional"

plugins:
  - references

parserPreset:
  parserOpts:
    issuePrefixes: ["#", '--bug=']

rules:
  #Allow Chinese
  subject-case: [0]
  # feat and fix must have issue references
  references-empty-enum: [2, "never", ["fix", "feat"]]

About

No description, topics, or website provided.
796.00 KiB
1 forks0 stars2 branches5 TagREADMEMIT license
Language
JavaScript78.3%
Dockerfile15.1%
Shell6.6%