We have used out of the box hooks for pre-commit for developement and are taken from Pre-commits
We use python
module to run the 3 exectutables from OS (foodcritic
, cookstyle
, rspec
) you can use any one or all as you want so you can skip un wanted deps.
Make sure you have installed
- foodcritic:
gem install foodcritic
See also http://www.foodcritic.io/ - cookstyle:
gem install cookstyle
requiresRuby >= 2.4.
See also https://docs.chef.io/cookstyle.html - rspec:
gem install rspec
See also http://www.foodcritic.io/ - pre-commit:
pip install pre-commit
this is needed so that our pre-commits work.
- Create a file
.pre-commit-config.yaml
in your root folder of repo (where you have .git) - Add this to your
.pre-commit-config.yaml
repos:
- repo: https://github.com/grizzly-monkey/chef-laughing-octo.git
sha: '' # Use the sha you want to point at release tag or a commit
hooks:
- id: check-foodcritic # if you want to run foodcritic for cookbooks in repo
- id: check-rspec # if you want to run rspec for recipies in the repo
- id: check-cookstyle # if you want to run cookstyle for cookbooks in repo
check-rspec
check-foodcritic
check-cookstyle