Some out-of-the-box hooks for pre-commit for chef development.
See also: https://github.com/pre-commit/pre-commit
Add this to your .pre-commit-config.yaml
- repo: git://github.com/pre-commit/pre-commit-hooks
sha: '' # Use the sha you want to point at
hooks:
- id: trailing-whitespace
# - id: ...
check-rspec
- run rspec on chef recipes.check-foodcritic
- run foodcritic on chef cookbooks.check-cookstyle
- run cookstyle on specific cookbook files.
If you'd like to use these hooks, they're also available as a standalone package.
Simply pip install pre-commit-hooks-chef