1.

Why Foodcritic is used in Chef?

Answer»

Foodcritic is an open-source tool used to detect common problems in our cookbooks like STYLE, syntaxes, BEST practices, correctness etc. Foodcritic validates the Ruby code written in cookbook against several rules and creates a list of violations without running a Chef Client run. List of rules is available in Foodcritic website.

A foodcritic is often run from chef-repo with the name of the cookbook whose correctness we are going to VERIFY. The correctness of the intention of the recipes in the cookbook is not checked instead the structure and syntax of the cookbook are checked. Whenever a Foodcritic DETECTS violation it doesn't typically mean a change of code. For eg: Assume that rule number “FC003” defines a scenario where recipe uses a search method to get relevant data from the Chef SERVER. The rule suggests that an error may occur in the cookbook when the Chef Server is unavailable. We only bother to adopt this rule only if chef-solo is a part of our project workflow as chef-solo doesn’t work with Chef Server.

Food critic could also be used with Continuous Integration servers like Jenkins and Travis thus enabling automated checking within the delivery pipeline of our project.



Discussion

No Comment Found