Chef Foodcritic
Foodcritic is a static linting tool that analyzes all of the Ruby code that is authored in a cookbook against a number of rules, and then returns a list of violations. The code in a cookbook is read, broken down, and then compared to Foodcritic rules.
Foodcritic does not validate the intention of a recipe, rather it evaluates the structure of the code, and helps specific behavior, detect portability of recipes, identify potential run-time failures, and spot common anti-patterns.
Use Foodcritic to check cookbooks for common problems:
*Style
*Correctness
*Syntax
*Best practices
*Common mistakes
*Deprecations
The foodcritic command is used to run Foodcritic against one (or more) cookbooks.
Foodcritic is run from the command line, typically against a single cookbook and all of the Ruby files contained within it
# foodcritic.
Checking 18 files
xxxxxxxxxxx.xxxxx.
FC008: Generated cookbook metadata needs updating: ./apache/metadata.rb:2
FC008: Generated cookbook metadata needs updating: ./apache/metadata.rb:3
FC008: Generated cookbook metadata needs updating: ./localuser/metadata.rb:2
FC008: Generated cookbook metadata needs updating: ./localuser/metadata.rb:3
FC008: Generated cookbook metadata needs updating: ./my_cookbook/metadata.rb:2
FC008: Generated cookbook metadata needs updating: ./my_cookbook/metadata.rb:3
FC008: Generated cookbook metadata needs updating: ./nginx/metadata.rb:2
FC008: Generated cookbook metadata needs updating: ./nginx/metadata.rb:3
FC008: Generated cookbook metadata needs updating: ./starter/metadata.rb:5
FC008: Generated cookbook metadata needs updating: ./user/metadata.rb:2
FC008: Generated cookbook metadata needs updating: ./user/metadata.rb:3
FC011: Missing README in markdown format: starter/README.md:1
FC064: Ensure issues_url is set in metadata: ./apache/metadata.rb:1
FC064: Ensure issues_url is set in metadata: ./localuser/metadata.rb:1
FC064: Ensure issues_url is set in metadata: ./my_cookbook/metadata.rb:1
FC064: Ensure issues_url is set in metadata: ./nginx/metadata.rb:1
FC064: Ensure issues_url is set in metadata: ./starter/metadata.rb:1
FC064: Ensure issues_url is set in metadata: ./user/metadata.rb:1
FC065: Ensure source_url is set in metadata: ./apache/metadata.rb:1
FC065: Ensure source_url is set in metadata: ./localuser/metadata.rb:1
FC065: Ensure source_url is set in metadata: ./my_cookbook/metadata.rb:1
FC065: Ensure source_url is set in metadata: ./nginx/metadata.rb:1
FC065: Ensure source_url is set in metadata: ./starter/metadata.rb:1
FC065: Ensure source_url is set in metadata: ./user/metadata.rb:1
FC066: Ensure chef_version is set in metadata: ./starter/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: ./apache/metadata.rb:1
ZippyOPS93 www.zippyops.com
FC067: Ensure at least one platform supported in metadata: ./localuser/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: ./my_cookbook/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: ./nginx/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: ./starter/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: ./user/metadata.rb:1
FC068: Ensure license is set in metadata: ./starter/metadata.rb:1
FC069: Ensure standardized license defined in metadata: ./starter/metadata.rb:1
FC071: Missing LICENSE file: starter/LICENSE:1
FC078: Ensure cookbook shared under an OSI-approved open source license: ./apache/metadata.rb:1
FC078: Ensure cookbook shared under an OSI-approved open source license:
./localuser/metadata.rb:1
FC078: Ensure cookbook shared under an OSI-approved open source license:
./my_cookbook/metadata.rb:1
FC078: Ensure cookbook shared under an OSI-approved open source license: ./nginx/metadata.rb:1
FC078: Ensure cookbook shared under an OSI-approved open source license: ./starter/metadata.rb:1
FC078: Ensure cookbook shared under an OSI-approved open source license: ./user/metadata.rb:1
FC093: Generated README text needs updating: apache/README.md:1
FC093: Generated README text needs updating: localuser/README.md:1
FC093: Generated README text needs updating: my_cookbook/README.md:1
FC093: Generated README text needs updating: nginx/README.md:1
FC093: Generated README text needs updating: user/README.md:1
Foodcritic returns a list, via standard output.
Recent Comments
No comments
Leave a Comment
We will be happy to hear what you think about this post