Build Status

Custom foodcritic rules. Should be generic for everyone working with Chef. Current focus is on automated testing.


Add this line to your Gemfile in chef-repo:

gem 'op-foodcritic-rules', git: '[email protected]:ofir-petrushka/op-foodcritic-rules.git'

And then execute bundle to install the gem.


Once you have installed the gem, simply run foodcritic with the -G option:

bundle exec foodcritic -G .


OP001: Include a kitchen test suite for every recipe not included by another

Kitchen tests are the recommended way for automated chef recipe testing. Generally speaking every recipe should have be in at least one test suite. This is a laxed rule not requiring recipes included by other recipes to have test suites.

This rules looks for entries in .kitchen.yml under runlists to have every recipe under your recipe directory.

For example:

# Good
$ ls cookbooks/my_cookbook/recipes/tested.rb
$ grep tested cookbooks/my_cookbook/.kitchen.yml
  - recipe[tested]

# Bad
$ ls cookbooks/my_cookbook/recipes/not_tested.rb
$ grep tested cookbooks/my_cookbook/.kitchen.yml

(empty result)


OP Foodcritic Rules

  • Author: Ofir Petrushka
  • Copyright: Copyright (c) Ofir Petrushka.
  • License: Apache License, Version 2.0