项目作者: alan-agius4

项目描述 :
Git commit message hook
高级语言: TypeScript
项目地址: git://github.com/alan-agius4/speedy-commit-msg-hook.git
创建时间: 2017-03-23T18:05:40Z
项目社区:https://github.com/alan-agius4/speedy-commit-msg-hook

开源协议:

下载


@speedy/commit-msg-hook

CircleCI
@speedy/commit-msg-hook"">npm version
dependencies Status
devDependencies Status

A highly customizable git commit message hook. Validates a commit message against a set of configuration, based on the Conventional Changelog standards.

Commit first line format:

  1. <type>(<scope>): <subject>

Installation

  1. npm install @speedy/commit-msg-hook --save-dev

Rules

The majority of the rules can be applied in any part of the configuration.

Name Description Type Section
no-unscoped Disallows unscoped commit messages boolean Message
skip-validation Disable validation for commit messages matching a RegExp. Useful for Merge and Revert commits) RegExp Message
valid-types An array of allowed commit message types ex: ["feat", "chore"] string[] Type
valid-scopes An array of allowed commit message scopes ex: ["router", "platform"] (Case sensitive) string[] Scope
banned-phrases An array of disallowed phrases. (Case insensitive) string[] All
max-length Requires text to be under a certain max length number All
no-dash Disallows dashes boolean All
no-space Disallows spaces boolean All
no-underscore Disallows underscores boolean All
no-camel-case Disallows camel cases boolean All
no-kebab-case Disallows kebab case boolean All
no-upper-first Enforces first character to be lower case boolean All
no-lower-first Enforces first character to be upper case boolean All
no-period-at-end Enforces last character not to be a period boolean All

Configuration

By default, will try to locate the speedy-commit-msg.json file in the root of your project folder.

If the file is not found it will fallback to an internal speedy-commit-msg.json found in config folder.

Default rules

speedy-commit-msg.json.

  1. {
  2. "rules": {
  3. "message": {
  4. "skip-validation": "^(Merge)\\s",
  5. "max-length": 100,
  6. "banned-phrases": [
  7. "minor change",
  8. "minor fix",
  9. "minor refactor",
  10. "pr change",
  11. "pr comment",
  12. "following pr"
  13. ],
  14. "no-period-at-end": true,
  15. "no-upper-first": true
  16. },
  17. "type": {
  18. "valid-types": [
  19. "feat",
  20. "fix",
  21. "docs",
  22. "style",
  23. "refactor",
  24. "perf",
  25. "test",
  26. "chore",
  27. "revert"
  28. ]
  29. },
  30. "scope": {
  31. "no-dash": true,
  32. "no-underscore": true
  33. },
  34. "subject": {
  35. "no-period-at-end": true,
  36. "no-upper-first": true
  37. }
  38. }
  39. }

extends

Configuration can be extended with one or many existing configurations.

  1. {
  2. "extends": [
  3. "@speedy/commit-msg-hook:latest"
  4. ],
  5. "rules": {
  6. "message": {
  7. "no-unscoped": true
  8. },
  9. "scope": {
  10. "no-dash": false
  11. }
  12. }
  13. }