This tool traverses a Node.js project repository history performing checks to ensure that certain conventions are followed:
- There is a lint script
- There is a test script
- Git blessed commit conventions are followed for every commit message.
- Every commit passes lint:
npm run lint
exits successfully - Every commit is green:
npm test
exits successfully
By default the script will pretty print the history and the status of the checks, when it's stdout is a TTY. If you pipe or redirect the outputs to a file, colors will be disabled and only the commit hashes and errors will be logged. Commit hashes always go to stdout (and success messages when stdout is a TTY), check failures always go to stderr, so you probably want to redirect both stdout and stderr if you are trying to capture the output in a file.
Output on a TTY
Output when stdout and stderr are redirected to a file
λ ~/code/test-repo/ git:(master ✗)» history-check &> output && cat output
HEAD: 13484c58588fff575b048f1d0593b39a9bba2902:
Test: script did not exit successfully
fd597301178b125c578a4b22d3049b5c4f86f3ba:
Commit message: Subject line longer than 50 characters
Commit message: Subject line not capitalised
Commit message: Subject line not separated by a blank line
Commit message: Body not wrapped at 72 characters
Lint: script did not exit successfully
Test: script did not exit successfully
10b18fa3989139e3ed89a32c389125779d42c5e3:
Commit message: Subject line not capitalised
Lint: script did not exit successfully
Test: script did not exit successfully
15bc24d19ec836997e802f5bc02fd1b9693eae2a:
Commit message: Subject line not capitalised
Lint: script did not exit successfully
Test: script did not exit successfully
ROOT: 15bc24d19ec836997e802f5bc02fd1b9693eae2a:
- bash (I have no idea if this works on windows bash)
- git
- node (tested on v6)
- json
make install
make uninstall