A commit name verification tool
Install your favorite git hook tool. (Recommended : Husky)
In your package.json, you can then start with your preferred hook : node -e require('commit-naming-enforcement')
Exemple (using Husky) :
...
"husky": {
"hooks": {
"pre-commit": "npm run precommit-msg && npm run eslint",
"pre-push": "node -e require('commit-naming-enforcement')"
}
}
...
A few config keys are availible, all setted/listed in defaults.js
, and can be overrided in the project's package.json
you need to use the corresponding key : commit-naming-enforcement
package.json :
...
"scripts": {},
"commit-naming-enforcement": {
"enabled" : true,
"regexToSeparateTitleAndBody" : ".",
"regexToCheckTitle" : ".",
"titleNotCorresponding" : "Commit title faulty, please see https://github.com/angular/angular/blob/master/CONTRIBUTING.md for guidelines"
}
...
If false, the commits won't be verified
This RegExp is used to separate the commit title and its body.
Then the title shall be parsed for conformity.
If you wish to do a validation check on all the commit (body + title), you can use this regex : "(\n|.)*"
The validation check. In the case of no-match, it is considered as an error.
Meaning the evaluated 'title' must match the regex for the commit to be accepted
The error message that will be displayed if the previous regexToCheckTitle
fail