Features:
- FC027: Resource sets internal attribute rule added. Thanks @macros.
- FC028: Incorrect #platform? usage rule added.
- FC029: No leading cookbook name in recipe metadata rule added.
- FC030: Cookbook contains debugger breakpoints rule added (related issue). Thanks @bryanwb.
- FC031: Cookbook without metadata file rule added (related issue). Thanks to @juanje for proposing and implementing this rule.
- FC032: Invalid notification timing rule added.
- Added the notifications API method to provide more convenient access to resource notifications (related issue).
Bugfixes:
- FC003: Check whether you are running with chef server before using server-specific features
would warn if solo was checked for with
Chef::Config.solo
(related issue). Thanks to @miketheman for identifying and fixing this issue. - FC007: Ensure recipe dependencies are reflected in cookbook metadata
would incorrectly warn if the cookbook name specified for
include_recipe
was dynamic (related issue). Thanks @markjreed. - FC019: Access node attributes in a consistent manner has been modified to no longer warn if the method called on node is called explicitly with brackets (related issue). Thanks @jaymzh.
- The resource_attributes API method has been updated to return boolean values correctly.
Bugfixes:
- Changes made to support multiple cookbook paths in 1.3.0 broke
compatibility with earlier versions of the linting API. This release
restores compatibility with third party code that uses the linter
#cookbook_path
or#valid_path?
methods. - The Nokogiri dependency constraint has been locked to 1.5.0 again as Nokogiri 1.5.3 also appears to segfault in certain circumstances.
Features:
- FC026: Conditional execution block attribute contains only string rule added (related issue). Thanks to @mkocher for proposing this rule.
- Foodcritic now accepts multiple cookbook paths as arguments and supports linting of individual files only. Big thanks to @cgriego for these changes. These lay the groundwork for his new guard-foodcritic project.
Bugfixes:
- FC003: Check whether you are running with chef server before using server-specific features would still warn if solo was checked for as a string (related issue). Thanks to @miketheman for identifying and fixing this issue.
- FC019: Access node attributes in a consistent manner would warn when the node object had been re-opened for extension (related issue). Thanks @jaymzh.
- FC020: Conditional execution string attribute looks like Ruby
updated to not warn against strings that appear to contain file paths or Windows
net use
(related issue). Thanks @eherot and @mconigliaro. - FC022: Resource condition within loop may not behave as expected would warn incorrectly if the resource name was set directly to the block variable rather than being a string expression (related issue). Thanks @eherot.
- The resource_attributes API method has been updated to return the AST for resource notifications (related issue). Thanks @jonlives.
Other:
- Etsy have open-sourced their Foodcritic rules. You should definitely check these out.
- The effective Chef version for determining the rules to apply has been bumped to 0.10.10.
Features:
- FC025: Prefer chef_gem to compile-time gem install rule added.
- Rules can now declare which versions of Chef they
apply_to
. The new command line argument-c
(--chef-version
) should be used to specify the effective Chef version.
Bugfixes:
- FC001: Use strings in preference to symbols to access node attributes could show false positives when using Chef search.
- FC001: Use strings in preference to symbols to access node attributes would overlook the use of symbols to access node attributes when passing template variables.
- FC002: Avoid string interpolation where not required fixed to no longer ignore the first keypair in a Hash (related issue). Thanks @Ips1975.
- FC004: Use a service resource to start and stop services
modified not to warn if the action is not supported by the
service
resource. - FC005: Avoid repetition of resource declarations modified not to warn when resources are branched within conditionals or provider actions.
- FC007: Ensure recipe dependencies are reflected in cookbook metadata
modified to ignore the use of
include_recipe
with embedded expressions. - FC023: Prefer conditional attributes
modified not to warn if the conditional expression has an
else
. - The
resource_attributes
API method has been updated to return block attributes which were previously ignored (related issue). Thanks @jonlives.
Features:
- FC024: Consider adding platform equivalents rule added.
- When writing new rules it is no longer necessary to explicitly map matching AST nodes to matches. You can now just return the AST nodes.
Bugfixes:
- The
cookbook_name
method now reflects the cookbook name if specified in metadata. This prevents a warning from being shown by FC007: Ensure recipe dependencies are reflected in cookbook metadata if the cookbook is in a differently named directory. - The
declared_dependencies
method previously would intermix version strings in the list of cookbook names.
Other:
- Chef 0.10.10 will include a new DSL method for defining a
default_action
for resources. Rule FC016: LWRP does not declare a default action has been updated to recognise the DSL change. - Nokogiri dependency constraint changed to no longer lock to 1.5.0 as their next release should include the fix for custom XPath functions.
Bugfixes:
- Nokogiri 1.5.1 and 1.5.2 cause a segfault so prevent their use until a fix is released (related issue). Thanks @miah.
Features:
- New
-I
option added to specify the path to your own custom rules (related issue). - The Rule API was previously not supported and subject to change without warning. From this release it will now follow the same versioning policy as the command line interface.
- A version flag (--version or -V) has been added (related issue).
Bugfixes:
- The evaluation of rule tags has been updated to be consistent with Cucumber. The major version number of foodcritic has been bumped to indicate that this is a breaking change. If you make use of tags (for example in a CI build) you may need to update your syntax. See the related issue for more information. Thanks @jaymzh.
- FC003: Check whether you are running with chef server before using server-specific features has been updated to correctly identify the new version of chef-solo-search (related issue).
Bugfixes:
- Foodcritic could fail to activate yajl-json in some circumstances, failing with a runtime error. Whether this occurred was dependent on the version of yajl-ruby activated by Chef, which would vary dependent on the other gems installed on the system. See the related issue for more information. Thanks @jaymzh for identifying the issue and striving to get Foodcritic playing well with Omnibus.
Bugfixes:
- Major bugfix to FC006: Mode should be quoted or fully specified when setting file permissions. In earlier versions a four-digit literal file mode that set the first octet would not have been picked up by this rule (related issue). Thanks @aia for finding and fixing this bug. Check your cookbooks against FC006 after upgrading to see if you are affected.
Features:
- Performance improvements.
- FC023: Prefer conditional attributes rule added. Stolen from @ampledata with thanks.
- New
-S
option added to allow an alternate search grammar to be specified.
Other:
- Chef is no longer loaded at startup for performance reasons. Foodcritic now ships with Chef DSL metadata.
Features:
- New experimental
-C
option added to output context for rule matches. - FC021: Resource condition in provider may not behave as expected rule added.
- FC022: Resource condition within loop may not behave as expected rule added.
Bugfixes:
- FC005: Avoid repetition of resource declarations rule modified to only warn when there are at least three consecutive resources of the same type that could be 'rolled up' into a loop.
- FC016: LWRP does not declare a default action rule restored. Thanks @stevendanna
- FC019: Access node attributes in a consistent manner rule modified to no longer treat DSL mixin methods as auto-vivified attributes. Identification of least used access method should now be accurate.
Other:
- FC020: Conditional execution string attribute looks like Ruby rule now grabs conditions from within single quotes.
Bugfixes:
- FC019: Access node attributes in a consistent manner modified to avoid false positives on methods invoked on values in a Mash.
Features:
- FC019: Access node attributes in a consistent manner rule added.
- FC020: Conditional execution string attribute looks like Ruby rule added.
Other:
- Rule 'FC016: LWRP does not declare a default action' was incorrectly checking the provider for a default action rather than the resource. Removed this rule temporarily to avoid showing false positives. A user has patched this and will be submitting a pull request shortly.
Features:
- New
-f
option added to allow you to specify which warnings should result in the build being failed. See the new documentation on using Foodcritic in Continuous Integration for more information. - New
-r
option added to drop you into the Pry REPL to interactively develop rules. See the updated documentation on Writing a new rule for more information.
Bugfixes:
- FC003: Check whether you are running with chef server before using server-specific features rule modified to not warn if the edelight chef-solo-search library has been installed. Thanks @tobami.
- FC007: Ensure recipe dependencies are reflected in cookbook metadata rule modified to flag undeclared dependencies against the offending file rather than metadata.rb.
- Removed the unused description field from the rule dsl.
Other:
- Project features now run much faster, running in-process by default. You can set an environment variable
(
FC_FORK_PROCESS
) to specify that Cucumber runs should match the earlier behaviour and spawn a separate process using Aruba.
Features:
- FC001: Use strings in preference to symbols to access node attributes rule added.
- FC004: Use a service resource to start and stop services rule extended to recognise upstart and invoke-rc.d.
- FC011: Missing README in markdown format rule added.
- FC012: Use Markdown for README rather than RDoc rule added.
- FC013: Use file_cache_path rather than hard-coding tmp paths rule added.
- FC014: Consider extracting long ruby_block to library rule added.
- FC015: Consider converting definition to a LWRP rule added.
- FC016: LWRP does not declare a default action rule added.
- FC017: LWRP does not notify when updated rule added.
- FC018: LWRP uses deprecated notification syntax rule added.
Bugfixes:
- Ensure warnings are line sorted numerically. Commit eb1762fd0fbf99fa513783d7838ceac0147c37bc
- FC005: Avoid repetition of resource declarations rule made less aggressive.
Bugfixes:
- Fix JSON version range for compatibility with Bundler / Chef 0.10.6. (related issue). Thanks @dysinger.
Features:
- Relaxed Ruby version constraint so we can run on 1.9.2 (related issue). Yay. Thanks @someara.
Features:
- Added the ability to choose rules to apply via tags (related issue). This uses the same syntax as Cucumber tag expressions.
- FC010: Invalid search syntax rule added.
Features:
- Spiffy new home page and documentation
- FC008: Generated cookbook metadata needs updating rule added.
- FC009: Resource attribute not recognised rule added. This adds a dependency on the Chef gem.
- Performance improvement.
Bugfixes:
- Fixed typo in FC004 feature description (related issue). Thanks @smith.
- Prevented statements within nested resource blocks from being interpreted as resource attributes.
Features:
- Significantly slower! But now you can write rules using xpath or css selectors.
- FC006: File mode rule added.
- FC007: Undeclared recipe dependencies rule added.
Bugfixes:
- Removed 'FC001: Use symbols in preference to strings to access node attributes' until a policy mechanism is introduced (related issue). Thanks @jtimberman
Initial version.