Lint tool for Chef cookbooks.
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
⚠️⚠️⚠️ All good things come to an end, and now is the time to say goodbye to Foodcritic. ⚠️⚠️⚠️
At this point we consider the Foodcritic project sunsetted and suggest all users move cookbook linting to Cookstyle.
Cookstyle with Chef cookbook support ships in Chef Workstation 0.9+ and ChefDK 4.4+. If you’d like to checkout the project or request new cops visit github.com/chef/cookstyle
Foodcritic is a code linting tool for writing better and safer Chef cookbooks that runs both as a command line tool and as a Rake task. Out of the box Foodcritic contains over 70 cookbook rules, and plugin system for writing your own rules.
$ gem install foodcritic $ foodcritic my_cookbook_dir
The Foodcritic site at http://foodcritic.io/ contains documentation for each of the rules as well as documentation on the API for writing your own rules.
$ bundle install $ bundle exec rake
Foodcritic includes rspec tests of the application itself and cucumber tests for each of the included rules. Each of these tests can be run via rake
Running rspec tests:
$ bundle exec rake spec
Running cucumber tests:
$ bundle exec rake features
Running regression tests:
$ bundle exec rake 'spec[regression]'
Foodcritic can also be used with Docker. To build and run Foodcritic in a Docker container please follow the instructions below.
Building the Docker image:
$ docker build --rm -t foodcritic/foodcritic .
Running Foodcritic inside a Docker container:
$ docker run -it --rm -v ~/cookbooks:/cookbooks foodcritic/foodcritic "/cookbooks"
Note: This will mount the host directory
~/cookbooksinto the container in the path
MIT - see the accompanying LICENSE file for details.
Additional rules and bug fixes are welcome! Please fork and submit a pull request on an individual branch per change.