60
loading...
This website collects cookies to deliver better user experience
Here we'll be automating our commit workflow i.e when a developer commits a code it will check for lint errors, do unit testing then inspect the code using SonarQube and check whether the commit message given by developer follows the commit convention or not. Only If all above conditions are satisfied the code will be commited.
Husky improves your commits and more 🐶 woof!
You can use it to lint your commit messages, run tests, lint code, etc... when you commit or push. Husky supports all Git hooks.
npm install husky --save-dev
npx husky-init
npx husky add .husky/commit-msg 'npx --no-install commitlint --edit'
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install commitlint --edit
npm install @commitlint/config-conventional @commitlint/cli --dev
git commit -m 'new fixes'
git commit -m 'style(package): package upgrade'
npm install lint-staged --save-dev
npm install eslint
ng add @angular-eslint/schematics
ng g @angular-eslint/schematics:convert-tslint-to-eslint --remove-tslint-if-no-more-tslint-targets --ignore-existing-tslint-config
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx pretty-quick --staged
npx lint-staged
ng test --watch=false --browsers=ChromeHeadless
git commit -m 'style(package): package upgrade'
For Mac Users:
https://techblost.com/how-to-setup-sonarqube-locally-on-mac/
For Windows Users:
npm install sonar-scanner --save-dev
"sonar": "sonar-scanner"
npm run sonar
http://localhost:9000/projects
and see the inspection result done on the project.git commit -m 'feat(sonar): sonarqube integrated'