git-code-validator
v1.0.0
Published
A simple Git commit validator that enforces Conventional Commits before push
Maintainers
Readme
git-code-validator
A lightweight Node.js CLI tool to enforce code quality and Conventional Commits before pushing code to your remote repository.
Features
- Commit Formatting Check: Reads the
pre-pushgit parameters and strictly validates exactly the commits about to be pushed against Conventional Commits formats (e.g.,feat: login page,fix(ui): resolving crash). - Code Quality Check: Before running the logic above, it checks if your
package.jsoncontains a"lint"script. If it does, it runsnpm run lintautomatically to prevent broken/unlinted code from leaving your machine.
Installation
Install it into your developer repository using NPM (as a dev dependency):
npm install git-code-validator --save-devSetup with Husky
The easiest way to integrate this into your git lifecycle is via Husky.
- Initialize husky in your project (if you haven't already):
npx husky init - Add the validator to your
pre-pushhook:echo "npx git-code-validator" > .husky/pre-push
That's it! Future git pushes will be securely vetted.
