Package Exports
- git-commit-msg-linter
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (git-commit-msg-linter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
git-commit-msg-linter
Watching your every git commit message. 👀
Install
npm install git-commit-msg-linter --save-devWhat's this
It's a git "commit-msg" hook for linting your git commit message against the Google AngularJS Git Commit Message Conventions. As a hook it will run at every commit to make sure your every commit message is valid against the conventions. If not your commit will be aborted.
The repo is heavily influenced by pre-commit. Thanks.
How it works
- On installing, it will copy the
{PROJECT}/.git/hooks/commit-msgexecutable file if it exists to{PROJECT}/.git/hooks/commit-msg.oldthen thecommit-msgwill be overwritten by injecting the linting rules contained in src filecommit-msg.js. - On committing, the
commit-msghook will be triggered to check your commit message. - On uninstalling, the
commit-msgfile will be restored and thecommit-msg.oldwill be deleted.
Why yet a new linter
- No "Google AngularJS Git Commit Message Conventions" linter hook ever existed now.
- It's very important to follow git commit message conventions and we recommend Google's.
commit message pattern
<type>(<scope>): <subject>
# scope optionalcommitlinterrc.json
Example:
{
"types": {
"feat": "new feature to the user",
"ci": "ci",
"build": "build",
"revert": "revert",
"deps": "upgrade dependency",
"temp": false
}
}Rules above means:
- Modify existing type
feat's description to "new feature to the user"; - Add four new types:
ci,build,revertanddeps; tempare prohibited.
TODO
- Existing rule can be overwritten and new ones can be added through
commitlinterrc.json. -
is-english-onlyshould be configurable throughcommitlinterrc.json, defaultfalse. -
max-lengthshould be configurable throughcommitlinterrc.json, default100. - First letter of
subjectmust be a lowercase one. -
subjectmust not end with dot. - Empty
scopeparenthesis not allowed. -
scopeparenthesis must be of English which means full-width ones are not allowed. - Keep a space between Chinese and English character.
Notice
git submodules not tested yet.