foodcritic 6.3.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +302 -681
  3. data/Gemfile +4 -0
  4. data/README.md +15 -11
  5. data/Rakefile +2 -1
  6. data/chef_dsl_metadata/chef_12.11.18.json +17597 -0
  7. data/features/009_check_for_unrecognised_resource_attributes.feature +6 -17
  8. data/features/032_check_for_invalid_notification_timing.feature +16 -12
  9. data/features/038_check_for_invalid_action.feature +6 -9
  10. data/features/043_check_for_old_notification_style.feature +0 -7
  11. data/features/step_definitions/cookbook_steps.rb +17 -11
  12. data/features/support/command_helpers.rb +1 -1
  13. data/foodcritic.gemspec +1 -2
  14. data/lib/foodcritic/api.rb +41 -13
  15. data/lib/foodcritic/linter.rb +1 -2
  16. data/lib/foodcritic/notifications.rb +1 -1
  17. data/lib/foodcritic/rules.rb +6 -12
  18. data/lib/foodcritic/version.rb +1 -1
  19. data/man/foodcritic.1 +81 -0
  20. data/spec/foodcritic/api_spec.rb +82 -0
  21. metadata +7 -38
  22. data/chef_dsl_metadata/chef_0.10.0.json +0 -7107
  23. data/chef_dsl_metadata/chef_0.10.10.json +0 -7900
  24. data/chef_dsl_metadata/chef_0.10.2.json +0 -7107
  25. data/chef_dsl_metadata/chef_0.10.4.json +0 -7302
  26. data/chef_dsl_metadata/chef_0.10.6.json +0 -7367
  27. data/chef_dsl_metadata/chef_0.10.8.json +0 -7367
  28. data/chef_dsl_metadata/chef_0.8.14.json +0 -6373
  29. data/chef_dsl_metadata/chef_0.8.16.json +0 -6373
  30. data/chef_dsl_metadata/chef_0.9.0.json +0 -6816
  31. data/chef_dsl_metadata/chef_0.9.10.json +0 -7480
  32. data/chef_dsl_metadata/chef_0.9.12.json +0 -7480
  33. data/chef_dsl_metadata/chef_0.9.14.json +0 -7484
  34. data/chef_dsl_metadata/chef_0.9.16.json +0 -7484
  35. data/chef_dsl_metadata/chef_0.9.18.json +0 -7484
  36. data/chef_dsl_metadata/chef_0.9.2.json +0 -6816
  37. data/chef_dsl_metadata/chef_0.9.4.json +0 -6861
  38. data/chef_dsl_metadata/chef_0.9.6.json +0 -6861
  39. data/chef_dsl_metadata/chef_0.9.8.json +0 -6865
  40. data/chef_dsl_metadata/chef_10.12.0.json +0 -7900
  41. data/chef_dsl_metadata/chef_10.14.0.json +0 -8457
  42. data/chef_dsl_metadata/chef_10.14.2.json +0 -8457
  43. data/chef_dsl_metadata/chef_10.14.4.json +0 -8457
  44. data/chef_dsl_metadata/chef_10.16.0.json +0 -8458
  45. data/chef_dsl_metadata/chef_10.16.2.json +0 -8458
  46. data/chef_dsl_metadata/chef_10.16.4.json +0 -8458
  47. data/chef_dsl_metadata/chef_10.16.6.json +0 -8458
  48. data/chef_dsl_metadata/chef_10.18.0.json +0 -8459
  49. data/chef_dsl_metadata/chef_10.18.2.json +0 -8459
  50. data/chef_dsl_metadata/chef_10.20.0.json +0 -8459
  51. data/chef_dsl_metadata/chef_10.22.0.json +0 -8459
  52. data/chef_dsl_metadata/chef_10.24.0.json +0 -8459
  53. data/chef_dsl_metadata/chef_10.24.4.json +0 -8459
  54. data/chef_dsl_metadata/chef_10.26.0.json +0 -8459
@@ -55,23 +55,12 @@ Feature: Check for unrecognised resource attributes
55
55
  When I check the cookbook
56
56
  Then the unrecognised attribute warning 009 should not be displayed
57
57
 
58
- Scenario Outline: Install package with yum specifying architecture
59
- Given a recipe that installs a package with yum specifying the architecture
58
+ Scenario Outline: Create raid array with mdadm specifying layout
59
+ Given a recipe that creates a raid array with mdadm specifying layout
60
60
  When I check the cookbook specifying <version> as the Chef version
61
61
  Then the unrecognised attribute warning 009 should be <shown>
62
62
  Examples:
63
- | version | shown |
64
- | 0.8.14 | true |
65
- | 0.9.6 | true |
66
- | 0.9.8 | false |
67
-
68
- Scenario Outline: Retry a resource on failure
69
- Given a recipe that installs a gem with 5 retries
70
- When I check the cookbook specifying <version> as the Chef version
71
- Then the unrecognised attribute warning 009 should be <shown>
72
- Examples:
73
- | version | shown |
74
- | 0.8.16 | true |
75
- | 0.9.0 | true |
76
- | 0.10.2 | true |
77
- | 0.10.4 | false |
63
+ | version | shown |
64
+ | 11.0.0 | true |
65
+ | 12.5.1 | true |
66
+ | 12.11.18 | false |
@@ -6,17 +6,21 @@ Feature: Check for invalid notification timings
6
6
 
7
7
  Scenario Outline: Notification timings
8
8
  Given a cookbook recipe with a resource that <type> <notification_timing>
9
- When I check the cookbook
9
+ When I check the cookbook specifying <version> as the Chef version
10
10
  Then the invalid notification timing warning 032 <display> be displayed
11
11
  Examples:
12
- | type | notification_timing | display |
13
- | notifies | | should not |
14
- | notifies | immediately | should not |
15
- | notifies | immediate | should not |
16
- | notifies | delayed | should not |
17
- | notifies | imediately | should |
18
- | subscribes | | should not |
19
- | subscribes | immediately | should not |
20
- | subscribes | immediate | should not |
21
- | subscribes | delayed | should not |
22
- | subscribes | imediately | should |
12
+ | type | notification_timing | version | display |
13
+ | notifies | | 12.6.0 | should not |
14
+ | notifies | before | 12.4.0 | should |
15
+ | notifies | before | 12.6.0 | should not |
16
+ | notifies | immediately | 12.6.0 | should not |
17
+ | notifies | immediate | 12.6.0 | should not |
18
+ | notifies | delayed | 12.6.0 | should not |
19
+ | notifies | imediately | 12.6.0 | should |
20
+ | subscribes | | 12.6.0 | should not |
21
+ | subscribes | before | 12.4.0 | should |
22
+ | subscribes | before | 12.6.0 | should not |
23
+ | subscribes | immediately | 12.6.0 | should not |
24
+ | subscribes | immediate | 12.6.0 | should not |
25
+ | subscribes | delayed | 12.6.0 | should not |
26
+ | subscribes | imediately | 12.6.0 | should |
@@ -38,14 +38,11 @@ Feature: Check for invalid resource actions
38
38
  | service | enble, start | should |
39
39
  | foo | energize, revitalize | should not |
40
40
 
41
- Scenario Outline: Reconfigure a package
42
- Given a recipe that reconfigures a package
41
+ Scenario Outline: Try to mask a systemd service
42
+ Given a recipe that tries to mask a systemd service
43
43
  When I check the cookbook specifying <version> as the Chef version
44
- Then the invalid resource action warning 038 <display> be displayed
44
+ Then the invalid resource action warning 038 should be <shown>
45
45
  Examples:
46
- | version | display |
47
- | 0.9.2 | should |
48
- | 0.10.0 | should |
49
- | 0.10.6.beta3 | should not |
50
- | 0.10.6 | should not |
51
- | 11.4.0 | should not |
46
+ | version | shown |
47
+ | 12.8.1 | false |
48
+ | 12.7.2 | true |
@@ -25,11 +25,4 @@ Feature: Check for old notification style
25
25
  Then the prefer new notification syntax warning 043 <displayed> be displayed
26
26
  Examples:
27
27
  | version | displayed |
28
- | 0.7.6 | should not |
29
- | 0.8.16 | should not |
30
- | 0.9.0 | should not |
31
- | 0.9.10 | should |
32
- | 0.9.18 | should |
33
- | 0.10.0 | should |
34
- | 10.24.0 | should |
35
28
  | 11.4.0 | should |
@@ -239,7 +239,7 @@ Given 'a cookbook provider that declares execute resources varying only in the c
239
239
  end
240
240
 
241
241
  Given /^a cookbook recipe that attempts to perform a search with (.*)$/ do |search_type|
242
- recipe_with_search(search_type.include?('subexpression') ? :with_subexpression : search_type.gsub(' ', '_').to_sym)
242
+ recipe_with_search(search_type.include?('subexpression') ? :with_subexpression : search_type.tr(' ', '_').to_sym)
243
243
  end
244
244
 
245
245
  Given /^a cookbook recipe that declares a resource called ([^ ]+) with the condition (.*)(in|outside) a loop$/ do |name,condition,is_loop|
@@ -1731,19 +1731,21 @@ Given 'a recipe that installs a gem with 5 retries' do
1731
1731
  }
1732
1732
  end
1733
1733
 
1734
- Given 'a recipe that installs a package with yum specifying the architecture' do
1734
+ Given 'a recipe that creates a raid array with mdadm specifying layout' do
1735
1735
  write_recipe %q{
1736
- yum_package "foo" do
1737
- arch "x86_64"
1738
- action :install
1736
+ mdadm '/dev/md0' do
1737
+ devices [ '/dev/sda', '/dev/sdb', '/dev/sdc', '/dev/sdd' ]
1738
+ level 5
1739
+ layout 'left-asymmetric'
1740
+ action [ :create, :assemble ]
1739
1741
  end
1740
1742
  }
1741
1743
  end
1742
1744
 
1743
- Given 'a recipe that reconfigures a package' do
1745
+ Given 'a recipe that tries to mask a systemd service' do
1744
1746
  write_recipe %q{
1745
- apt_package "foo" do
1746
- action :reconfig
1747
+ service 'foo' do
1748
+ action :mask
1747
1749
  end
1748
1750
  }
1749
1751
  end
@@ -1834,7 +1836,7 @@ end
1834
1836
  When /^I check the cookbook specifying ([^ ]+) as the Chef version$/ do |version|
1835
1837
  options = ['-c', version, 'cookbooks/example']
1836
1838
  cd '.' do
1837
- options = ['-I', 'rules/test.rb'] + options if Dir.exists?('rules')
1839
+ options = ['-I', 'rules/test.rb'] + options if Dir.exist?('rules')
1838
1840
  end
1839
1841
  run_lint(options)
1840
1842
  end
@@ -1968,7 +1970,7 @@ end
1968
1970
 
1969
1971
  When /^I run it on the command line with the (?:unimplemented |)([^ ]+) option( with an argument)?$/ do |option, with_argument|
1970
1972
  options = []
1971
- if option.match(/\-\w$/)
1973
+ if option =~ /\-\w$/
1972
1974
  options << option
1973
1975
  else
1974
1976
  options << "--#{option}"
@@ -2139,7 +2141,7 @@ Then /the build status should be (successful|failed)$/ do |build_outcome|
2139
2141
  end
2140
2142
 
2141
2143
  Then /^the build will (succeed|fail) with (?:no )?warnings(.*)$/ do |build_outcome, warnings|
2142
- assert_build_result(build_outcome == 'succeed', warnings.gsub(' ', '').split(','))
2144
+ assert_build_result(build_outcome == 'succeed', warnings.delete(' ').split(','))
2143
2145
  end
2144
2146
 
2145
2147
  Then 'the check for server warning 003 should not be displayed against the condition' do
@@ -2299,6 +2301,10 @@ Then /^the unrecognised attribute warning 009 should be (true|false)$/ do |shown
2299
2301
  shown == 'true' ? expect_warning('FC009') : expect_no_warning('FC009')
2300
2302
  end
2301
2303
 
2304
+ Then /^the invalid resource action warning 038 should be (true|false)$/ do |shown|
2305
+ shown == 'true' ? expect_warning('FC038') : expect_no_warning('FC038')
2306
+ end
2307
+
2302
2308
  Then 'the unrecognised attribute warning 009 should be displayed against the correct resource' do
2303
2309
  expect_warning('FC009', :line => 7)
2304
2310
  end
@@ -299,7 +299,7 @@ module FoodCritic
299
299
  elsif show_context
300
300
  ContextOutput.new.output(review)
301
301
  else
302
- "#{review.to_s}\n"
302
+ "#{review}\n"
303
303
  end
304
304
  end
305
305
  end
data/foodcritic.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.homepage = 'http://foodcritic.io'
11
11
  s.license = 'MIT'
12
12
  s.executables << 'foodcritic'
13
- s.required_ruby_version = ">= 2.0.0"
13
+ s.required_ruby_version = '>= 2.1.0'
14
14
  s.add_dependency('cucumber-core', '>= 1.3')
15
15
  s.add_dependency('nokogiri', '>= 1.5', '< 2.0')
16
16
  s.add_dependency('rake')
@@ -24,5 +24,4 @@ Gem::Specification.new do |s|
24
24
  s.files += Dir['Rakefile'] + Dir['Gemfile'] + Dir["*.gemspec"]
25
25
  s.files += Dir['spec/**/*'] + Dir['features/**/*']
26
26
  s.files += Dir['*.md'] + Dir['LICENSE'] + Dir['man/*']
27
- s.required_ruby_version = '>= 2.0.0'
28
27
  end
@@ -75,26 +75,54 @@ module FoodCritic
75
75
  end
76
76
  end
77
77
 
78
- # The name of the cookbook containing the specified file.
79
- def cookbook_name(file)
80
- fail ArgumentError, 'File cannot be nil or empty' if file.to_s.empty?
81
-
78
+ # Support function to retrieve a metadata field
79
+ def metadata_field(file, field)
82
80
  until (file.split(File::SEPARATOR) & standard_cookbook_subdirs).empty? do
83
81
  file = File.absolute_path(File.dirname(file.to_s))
84
82
  end
85
83
  file = File.dirname(file) unless File.extname(file).empty?
86
- # We now have the name of the directory that contains the cookbook.
87
84
 
88
- # We also need to consult the metadata in case the cookbook name has been
89
- # overridden there. This supports only string literals.
90
85
  md_path = File.join(file, 'metadata.rb')
91
86
  if File.exist?(md_path)
92
- name = read_ast(md_path).xpath("//stmts_add/
93
- command[ident/@value='name']/
87
+ value = read_ast(md_path).xpath("//stmts_add/
88
+ command[ident/@value='#{field}']/
94
89
  descendant::tstring_content/@value").to_s
95
- return name unless name.empty?
90
+ raise RuntimeError, "Cant read #{field} from #{md_path}" if value.to_s.empty?
91
+ return value
92
+ else
93
+ raise RuntimeError, "Cant find #{md_path}"
96
94
  end
97
- File.basename(file)
95
+ end
96
+
97
+ # The name of the cookbook containing the specified file.
98
+ def cookbook_name(file)
99
+ fail ArgumentError, 'File cannot be nil or empty' if file.to_s.empty?
100
+
101
+ # Name is a special case as we want to fallback to the cookbook directory
102
+ # name if metadata_field fails
103
+ begin
104
+ metadata_field(file, 'name')
105
+ rescue RuntimeError
106
+ until (file.split(File::SEPARATOR) & standard_cookbook_subdirs).empty? do
107
+ file = File.absolute_path(File.dirname(file.to_s))
108
+ end
109
+ file = File.dirname(file) unless File.extname(file).empty?
110
+ File.basename(file)
111
+ end
112
+ end
113
+
114
+ # The maintainer of the cookbook containing the specified file.
115
+ def cookbook_maintainer(file)
116
+ fail ArgumentError, 'File cannot be nil or empty' if file.to_s.empty?
117
+
118
+ metadata_field(file, 'maintainer')
119
+ end
120
+
121
+ # The maintainer email of the cookbook containing the specified file.
122
+ def cookbook_maintainer_email(file)
123
+ fail ArgumentError, 'File cannot be nil or empty' if file.to_s.empty?
124
+
125
+ metadata_field(file, 'maintainer_email')
98
126
  end
99
127
 
100
128
  # The dependencies declared in cookbook metadata.
@@ -469,7 +497,7 @@ module FoodCritic
469
497
  end
470
498
 
471
499
  def patched_node_method?(meth, cookbook_dir)
472
- return false if cookbook_dir.nil? || !Dir.exists?(cookbook_dir)
500
+ return false if cookbook_dir.nil? || !Dir.exist?(cookbook_dir)
473
501
 
474
502
  # TODO: Modify this to work with multiple cookbook paths
475
503
  cbk_tree_path = Pathname.new(File.join(cookbook_dir, '..'))
@@ -478,7 +506,7 @@ module FoodCritic
478
506
  libs.any? do |lib|
479
507
  !read_ast(lib).xpath(%Q{//class[count(descendant::const[@value='Chef'])
480
508
  > 0][count(descendant::const[@value='Node']) > 0]/descendant::def/
481
- ident[@value='#{meth.to_s}']}).empty?
509
+ ident[@value='#{meth}']}).empty?
482
510
  end
483
511
  end
484
512
 
@@ -1,6 +1,5 @@
1
1
  require 'optparse'
2
2
  require 'ripper'
3
- require 'rubygems'
4
3
  require 'set'
5
4
 
6
5
  module FoodCritic
@@ -10,7 +9,7 @@ module FoodCritic
10
9
 
11
10
  # The default version that will be used to determine relevant rules. This
12
11
  # can be over-ridden at the command line with the `--chef-version` option.
13
- DEFAULT_CHEF_VERSION = '12.9.38'
12
+ DEFAULT_CHEF_VERSION = '12.11.18'
14
13
  attr_reader :chef_version
15
14
 
16
15
  # Perform a lint check. This method is intended for use by the command-line
@@ -50,7 +50,7 @@ module FoodCritic
50
50
  # The target resource action.
51
51
  action: notification_action(notify),
52
52
 
53
- # The notification timing. Either `:immediate` or `:delayed`.
53
+ # The notification timing: `:before`, `:immediate` or `:delayed`.
54
54
  timing: notification_timing(notify)
55
55
  }
56
56
  )
@@ -196,7 +196,6 @@ end
196
196
 
197
197
  rule 'FC015', 'Consider converting definition to a Custom Resource' do
198
198
  tags %w(style definitions lwrp)
199
- applies_to { |version| version >= gem_version('0.7.12') }
200
199
  cookbook do |dir|
201
200
  Dir[File.join(dir, 'definitions', '*.rb')].reject do |entry|
202
201
  ['.', '..'].include? entry
@@ -206,7 +205,6 @@ end
206
205
 
207
206
  rule 'FC016', 'LWRP does not declare a default action' do
208
207
  tags %w(correctness lwrp)
209
- applies_to { |version| version >= gem_version('0.7.12') }
210
208
  resource do |ast, filename|
211
209
  unless ["//ident/@value='default_action'",
212
210
  "//def/bodystmt/descendant::assign/
@@ -218,9 +216,6 @@ end
218
216
 
219
217
  rule 'FC017', 'LWRP does not notify when updated' do
220
218
  tags %w(correctness lwrp)
221
- applies_to do |version|
222
- version >= gem_version('0.7.12')
223
- end
224
219
  provider do |ast, filename|
225
220
 
226
221
  use_inline_resources = !ast.xpath('//*[self::vcall or self::var_ref]/ident
@@ -251,7 +246,6 @@ end
251
246
 
252
247
  rule 'FC018', 'LWRP uses deprecated notification syntax' do
253
248
  tags %w(style lwrp deprecated)
254
- applies_to { |version| version >= gem_version('0.9.10') }
255
249
  provider do |ast|
256
250
  ast.xpath("//assign/var_field/ivar[@value='@updated']").map do |class_var|
257
251
  match(class_var)
@@ -297,7 +291,6 @@ end
297
291
 
298
292
  rule 'FC021', 'Resource condition in provider may not behave as expected' do
299
293
  tags %w(correctness lwrp)
300
- applies_to { |version| version >= gem_version('0.10.6') }
301
294
  provider do |ast|
302
295
  find_resources(ast).map do |resource|
303
296
  condition = resource.xpath(%q{//method_add_block/
@@ -312,7 +305,6 @@ end
312
305
 
313
306
  rule 'FC022', 'Resource condition within loop may not behave as expected' do
314
307
  tags %w(correctness)
315
- applies_to { |version| version >= gem_version('0.10.6') }
316
308
  recipe do |ast|
317
309
  ast.xpath("//call[ident/@value='each']/../do_block[count(ancestor::
318
310
  method_add_block/method_add_arg/fcall/ident[@value='only_if' or
@@ -391,7 +383,6 @@ end
391
383
 
392
384
  rule 'FC025', 'Prefer chef_gem to compile-time gem install' do
393
385
  tags %w(style deprecated)
394
- applies_to { |version| version >= gem_version('0.10.10') }
395
386
  recipe do |ast|
396
387
  gem_install = ast.xpath("//stmts_add/assign[method_add_block[command/ident/
397
388
  @value='gem_package'][do_block/stmts_add/command[ident/@value='action']
@@ -410,7 +401,6 @@ end
410
401
 
411
402
  rule 'FC026', 'Conditional execution block attribute contains only string' do
412
403
  tags %w(correctness)
413
- applies_to { |version| version >= gem_version('0.7.4') }
414
404
  recipe do |ast|
415
405
  find_resources(ast).map { |r| resource_attributes(r) }.map do |resource|
416
406
  [resource['not_if'], resource['only_if']]
@@ -482,9 +472,14 @@ end
482
472
  rule 'FC032', 'Invalid notification timing' do
483
473
  tags %w(correctness notifications)
484
474
  recipe do |ast|
475
+ valid_timings = if resource_attribute?('file', 'notifies_before') then
476
+ [:delayed, :immediate, :before]
477
+ else
478
+ [:delayed, :immediate]
479
+ end
485
480
  find_resources(ast).select do |resource|
486
481
  notifications(resource).any? do |notification|
487
- ! [:delayed, :immediate].include? notification[:timing]
482
+ ! valid_timings.include? notification[:timing]
488
483
  end
489
484
  end
490
485
  end
@@ -632,7 +627,6 @@ end
632
627
 
633
628
  rule 'FC043', 'Prefer new notification syntax' do
634
629
  tags %w(style notifications deprecated)
635
- applies_to { |version| version >= gem_version('0.9.10') }
636
630
  recipe do |ast|
637
631
  find_resources(ast).select do |resource|
638
632
  notifications(resource).any? { |notify| notify[:style] == :old }
@@ -1,4 +1,4 @@
1
1
  module FoodCritic
2
2
  # The current version of foodcritic
3
- VERSION = '6.3.0'
3
+ VERSION = '7.0.0'
4
4
  end
data/man/foodcritic.1 ADDED
@@ -0,0 +1,81 @@
1
+ .\" generated with Ronn/v0.7.3
2
+ .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
+ .
4
+ .TH "FOODCRITIC" "1" "February 2016" "" ""
5
+ .
6
+ .SH "NAME"
7
+ \fBfoodcritic\fR \- lint tool for chef cookbooks
8
+ .
9
+ .SH "SYNOPSIS"
10
+ \fBfoodcritic\fR [\fIoptions\fR\.\.\.] \fIcookbook\fR\.\.\.
11
+ .
12
+ .P
13
+ \fBfoodcritic\fR [\fIoptions\fR\.\.\.] \-\-list
14
+ .
15
+ .SH "DESCRIPTION"
16
+ \fBfoodcritic\fR makes it easier to flag problems in your Chef cookbooks that will cause Chef to blow up when you attempt to converge\. This is about faster feedback\.
17
+ .
18
+ .P
19
+ Each \fBcookbook\fR path specified will be examined for common problems and poor style\.
20
+ .
21
+ .SH "OPTIONS"
22
+ .
23
+ .TP
24
+ \fB\-t\fR, \fB\-\-tags\fR \fITAGS\fR
25
+ Only check against rules with the specified tags\. Prefix tags with a tilde \fB~\fR to exclude rules\.
26
+ .
27
+ .TP
28
+ \fB\-l\fR, \fB\-\-list\fR
29
+ Do not perform a lint check; instead simply list the rules that would be enabled based on the defaults and the rule selection options (\-t, \-I)
30
+ .
31
+ .TP
32
+ \fB\-f\fR, \fB\-\-epic\-fail\fR \fITAGS\fR
33
+ Exit non\-zero if any of the specified tags are matched\. Use the pseudo\-tag \fBany\fR to fail if any tag is matched\.
34
+ .
35
+ .TP
36
+ \fB\-c\fR, \fB\-\-chef\-version\fR \fIVERSION\fR
37
+ Only check against rules valid for this version of Chef\.
38
+ .
39
+ .TP
40
+ \fB\-B\fR, \fB\-\-cookbook\-path\fR
41
+ Cookbook path(s) to check\.
42
+ .
43
+ .TP
44
+ \fB\-C\fR, \fB\-\-\fR[\fBno\-\fR]\fBcontext\fR
45
+ Show lines matched against rather than the default summary\.
46
+ .
47
+ .TP
48
+ \fB\-E\fR, \fB\-\-environment\-path\fR
49
+ Environment path(s) to check\.
50
+ .
51
+ .TP
52
+ \fB\-I\fR, \fB\-\-include\fR \fIPATH\fR
53
+ Additional rule file path(s) to load\.
54
+ .
55
+ .TP
56
+ \fB\-R\fR, \fB\-\-role\-path\fR
57
+ Role path(s) to check\.
58
+ .
59
+ .TP
60
+ \fB\-S\fR, \fB\-\-search\-grammar\fR \fIPATH\fR
61
+ Specify grammar to use when validating search syntax\. (Default: the grammar of any installed Chef)
62
+ .
63
+ .TP
64
+ \fB\-V\fR, \fB\-\-version\fR
65
+ Display the foodcritic version\.
66
+ .
67
+ .TP
68
+ \fB\-X\fR, \fB\-\-exclude\fR \fIPATH\fR
69
+ Exclude path(s) from being linted\.
70
+ .
71
+ .SH "RETURN VALUES"
72
+ By default, \fBfoodcritic\fR will always return \fB0\fR\.
73
+ .
74
+ .P
75
+ If \fB\-\-epic\-fail\fR is specified, then \fBfoodcritic\fR will return \fB3\fR if any tags are matched\.
76
+ .
77
+ .SH "COPYRIGHT"
78
+ \fBfoodcritic\fR is Copyright 2011 by Andrew Crump\.
79
+ .
80
+ .SH "SEE ALSO"
81
+ chef(1)