Lint tool for Chef cookbooks.
Ruby Gherkin
Latest commit be46524 Nov 14, 2017 @tas50 tas50 committed with damacus Release 12.2.1 with a fix for FC104 alerting on all resource types (#701

* Don't false alert on any resource with a :create action

ast.xpath('//method_add_block[command/ident[@value="ruby_block"]]') was
returning [] which evals to true so we were actually looking for a
:create action on any resource. I've added a spec for this scenario and
used the API to check the resource type instead

* Release 12.2.1

* Chefstyle + a spec fix

Signed-off-by: Tim Smith <>


Build Status Gem Version

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.

Basic Usage

$ gem install foodcritic
$ foodcritic my_cookbook_dir


The Foodcritic site at contains documentation for each of the rules as well as documentation on the API for writing your own rules.


  • Ruby 2.2.2+

Building Foodcritic

$ bundle install
$ bundle exec rake

Testing Foodcritic

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 ~/cookbooks into the container in the path /cookbooks.


MIT - see the accompanying LICENSE file for details.


To see what has changed in recent versions see the CHANGELOG. Foodcritic follows the Rubygems Semantic Versioning Policy.


Additional rules and bug fixes are welcome! Please fork and submit a pull request on an individual branch per change.