foodcritic 12.2.2 → 12.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +12 -0
  3. data/features/step_definitions/cookbook_steps.rb +0 -5
  4. data/features/support/command_helpers.rb +0 -6
  5. data/lib/foodcritic/api.rb +8 -4
  6. data/lib/foodcritic/rules/fc110.rb +18 -0
  7. data/lib/foodcritic/rules/fc111.rb +7 -0
  8. data/lib/foodcritic/rules/fc112.rb +6 -0
  9. data/lib/foodcritic/rules/fc113.rb +13 -0
  10. data/lib/foodcritic/rules/fc114.rb +32 -0
  11. data/lib/foodcritic/version.rb +1 -1
  12. data/spec/functional/fc110_spec.rb +21 -0
  13. data/spec/functional/fc111_spec.rb +17 -0
  14. data/spec/functional/fc112_spec.rb +17 -0
  15. data/spec/functional/{fc057_spec.rb → fc113_spec.rb} +39 -3
  16. data/spec/functional/fc114_spec.rb +31 -0
  17. data/spec/regression/expected/aix.txt +19 -0
  18. data/spec/regression/expected/apt.txt +0 -3
  19. data/spec/regression/expected/ark.txt +1 -0
  20. data/spec/regression/expected/auditd.txt +0 -4
  21. data/spec/regression/expected/aws.txt +0 -4
  22. data/spec/regression/expected/bluepill.txt +0 -1
  23. data/spec/regression/expected/chef-ingredient.txt +1 -0
  24. data/spec/regression/expected/chef-vault.txt +1 -0
  25. data/spec/regression/expected/chef_handler.txt +0 -1
  26. data/spec/regression/expected/cron.txt +0 -2
  27. data/spec/regression/expected/dmg.txt +0 -2
  28. data/spec/regression/expected/dynect.txt +0 -1
  29. data/spec/regression/expected/firewall.txt +0 -5
  30. data/spec/regression/expected/gunicorn.txt +0 -2
  31. data/spec/regression/expected/heartbeat.txt +0 -3
  32. data/spec/regression/expected/homebrew.txt +0 -3
  33. data/spec/regression/expected/iis.txt +0 -21
  34. data/spec/regression/expected/libarchive.txt +0 -1
  35. data/spec/regression/expected/lvm.txt +0 -4
  36. data/spec/regression/expected/maven.txt +0 -3
  37. data/spec/regression/expected/ohai.txt +2 -0
  38. data/spec/regression/expected/php.txt +0 -5
  39. data/spec/regression/expected/powershell.txt +0 -2
  40. data/spec/regression/expected/rsync.txt +0 -3
  41. data/spec/regression/expected/runit.txt +1 -0
  42. data/spec/regression/expected/smokeping.txt +0 -1
  43. data/spec/regression/expected/sudo.txt +0 -2
  44. data/spec/regression/expected/tar.txt +2 -0
  45. data/spec/regression/expected/transmission.txt +0 -1
  46. data/spec/regression/expected/users.txt +0 -1
  47. data/spec/regression/expected/webpi.txt +0 -2
  48. data/spec/regression/expected/windows.txt +0 -34
  49. data/spec/regression/expected/yum.txt +0 -5
  50. data/spec/unit/api_spec.rb +5 -1
  51. metadata +14 -10
  52. data/features/017_check_for_no_lwrp_notifications.feature +0 -50
  53. data/lib/foodcritic/rules/fc017.rb +0 -29
  54. data/lib/foodcritic/rules/fc057.rb +0 -8
  55. data/lib/foodcritic/rules/fc059.rb +0 -10
  56. data/spec/functional/fc059_spec.rb +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4cca4b9220b37c61b2a6787963597afc99c36c91
4
- data.tar.gz: 3efa091b16afb38ed2ba05425ac378ca410cb450
2
+ SHA256:
3
+ metadata.gz: d2c822721f854188805664e8d9d8402c276d7bf107206e82efbc3dd182913b4d
4
+ data.tar.gz: 906e425bf8eb50f982a17d6b94e7295caa8ec55b61ad247fb6922fd12907e9f1
5
5
  SHA512:
6
- metadata.gz: 22978558516fe2c9f8880ccd148155070d88ae8457c4861bf13b8963dcacd5a8dc12c85f4de74bedb564611765c3f980703365826bb3e45da6ab38a0c1b93df6
7
- data.tar.gz: 46a58bedda591bf9ab373b56229d76173b11b4a8b5e7173b8b4eda45799616e02df3d090448ce376079d7d3763504092d0ef6a57c4cd257aa1aa3a1f4f381c8c
6
+ metadata.gz: 9a5bb0f99a420531ec5cc5d413fb9c7c9838e6eb9f369c03f2b544fd7361fd53cfc01b1482a511df2497f2616e49b463cf558032144495c8eed89754770bdc5b
7
+ data.tar.gz: 9d68253b11de0c814ffb4120e133779149b4f9670e7c3b2206ae3c0893d18cd627e1d612f47cbb9b6d6077a1b1315e7d9cced6a69e4bb6de2ec209903d64f61f
@@ -1,5 +1,17 @@
1
1
  # Foodcritic Changelog:
2
2
 
3
+ ## [12.3.0](https://github.com/Foodcritic/foodcritic/tree/v12.3.0) (2018-01-18)
4
+
5
+ **Implemented enhancements:**
6
+
7
+ - Removed FC017, FC057, and FC059 as use_inline_resources is the default in Chef 13 and no longer required
8
+ - Added FC110: Script resources should use 'code' property not 'command' property
9
+ - Added FC111: search using deprecated sort flag
10
+ - Added FC112 Resource using deprecated dsl_name method
11
+ - Added FC113 Resource declares deprecated use_inline_resources
12
+ - Added FC114 Cookbook uses legacy Ohai config syntax
13
+ - Extended the find_resources method to allow accepting an array of resource names not just a single resource name
14
+
3
15
  ## [12.2.2](https://github.com/Foodcritic/foodcritic/tree/v12.2.2) (2017-12-13)
4
16
 
5
17
  **Fixed bugs:**
@@ -1618,11 +1618,6 @@ Then "the execute resource used to run git commands warning 040 should be displa
1618
1618
  expect_warning "FC040", { :line => 7 }
1619
1619
  end
1620
1620
 
1621
- Then /^the LWRP does not notify when updated warning 017 should( not)? be shown against the :([^ ]+) action$/ do |not_shown, action|
1622
- line = action == "create" ? 1 : 8
1623
- expect_warning("FC017", :file_type => :provider, :expect_warning => ! not_shown, :line => line)
1624
- end
1625
-
1626
1621
  Then /^the invalid (role|environment) name warning 050 should( not)? be shown$/ do |type, not_shown|
1627
1622
  file = type == "role" ? "roles/webserver.rb" : "environments/production.rb"
1628
1623
  expect_warning "FC050", { :expect_warning => ! not_shown, :file => file }
@@ -17,7 +17,6 @@ module FoodCritic
17
17
  WARNINGS = {
18
18
  "FC001" => "Use strings in preference to symbols to access node attributes",
19
19
  "FC002" => "Avoid string interpolation where not required",
20
- # FC003 was yanked and is considered reserved, do not reuse it
21
20
  "FC004" => "Use a service resource to start and stop services",
22
21
  "FC005" => "Avoid repetition of resource declarations",
23
22
  "FC006" => "Mode should be quoted or fully specified when setting file permissions",
@@ -31,12 +30,10 @@ module FoodCritic
31
30
  "FC014" => "Consider extracting long ruby_block to library",
32
31
  "FC015" => "Consider converting definition to a Custom Resource",
33
32
  "FC016" => "LWRP does not declare a default action",
34
- "FC017" => "LWRP does not notify when updated",
35
33
  "FC018" => "LWRP uses deprecated notification syntax",
36
34
  "FC019" => "Access node attributes in a consistent manner",
37
35
  "FC021" => "Resource condition in provider may not behave as expected",
38
36
  "FC022" => "Resource condition within loop may not behave as expected",
39
- # FC023 was yanked and is considered reserved, do not reuse it
40
37
  "FC024" => "Consider adding platform equivalents",
41
38
  "FC025" => "Prefer chef_gem to compile-time gem install",
42
39
  "FC026" => "Conditional execution block attribute contains only string",
@@ -65,12 +62,9 @@ module FoodCritic
65
62
  "FC051" => "Template partials loop indefinitely",
66
63
  "FC052" => 'Metadata uses the deprecated "suggests" keyword',
67
64
  "FC053" => 'Metadata uses the deprecated "recommends" keyword',
68
- # FC054 was yanked and is considered reserved, do not reuse it
69
65
  "FC055" => "Ensure maintainer is set in metadata",
70
66
  "FC056" => "Ensure maintainer_email is set in metadata",
71
- "FC057" => "Library provider does not declare use_inline_resources",
72
67
  "FC058" => "Library provider declares use_inline_resources and declares #action_<name> methods",
73
- "FC059" => "LWRP provider does not declare use_inline_resources",
74
68
  "FC060" => "LWRP provider declares use_inline_resources and declares #action_<name> methods",
75
69
  "FC061" => "Valid cookbook versions are of the form x.y or x.y.z",
76
70
  "FC062" => "Cookbook should have version metadata",
@@ -179,17 +179,21 @@ module FoodCritic
179
179
  # These are equivalent:
180
180
  #
181
181
  # find_resources(ast)
182
- # find_resources(ast, :type => :any)
182
+ # find_resources(ast, type: :any)
183
183
  #
184
- # Restrict to a specific type of resource:
184
+ # Restrict to a specific type of resource(s):
185
185
  #
186
- # find_resources(ast, :type => :service)
186
+ # find_resources(ast, type: 'service')
187
+ # find_resources(ast, type: %w(service file))
187
188
  #
188
189
  def find_resources(ast, options = {})
189
190
  options = { type: :any }.merge!(options)
190
191
  return [] unless ast.respond_to?(:xpath)
191
192
  scope_type = ""
192
- scope_type = "[@value='#{options[:type]}']" unless options[:type] == :any
193
+ unless options[:type] == :any
194
+ type_array = Array(options[:type]).map { |x| "@value='#{x}'" }
195
+ scope_type = "[#{type_array.join(' or ')}]"
196
+ end
193
197
 
194
198
  # TODO: Include nested resources (provider actions)
195
199
  no_actions = "[command/ident/@value != 'action']"
@@ -0,0 +1,18 @@
1
+ rule "FC110", "Script resources should use 'code' property not 'command' property" do
2
+ tags %w{deprecation chef13}
3
+ recipe do |ast|
4
+ script_resources = %w{ bash
5
+ ksh
6
+ cash
7
+ script
8
+ batch
9
+ perl
10
+ python
11
+ ruby
12
+ windows_script
13
+ }
14
+ find_resources(ast, type: script_resources).find_all do |resources|
15
+ resource_attribute(resources, "command")
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,7 @@
1
+ rule "FC111", "search using deprecated sort flag" do
2
+ tags %w{deprecation chef13}
3
+ recipe do |ast|
4
+ # search(:node, 'role:web', :sort => true)
5
+ ast.xpath("//method_add_arg[fcall/ident/@value='search'][arg_paren/args_add_block/args_add/bare_assoc_hash/assoc_new/symbol/ident/@value = 'sort']")
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ rule "FC112", "Resource using deprecated dsl_name method" do
2
+ tags %w{deprecation chef13}
3
+ recipe do |ast|
4
+ ast.xpath("//call/ident[@value='dsl_name']")
5
+ end
6
+ end
@@ -0,0 +1,13 @@
1
+ rule "FC113", "Resource declares deprecated use_inline_resources" do
2
+ tags %w{deprecation chef15 lwrp}
3
+ library do |ast|
4
+ matches = []
5
+ ast.xpath('//const_path_ref/const[@value="LWRPBase"]/..//const[@value="Provider"]/../../..').select do |x|
6
+ matches << x.xpath('//*[self::vcall or self::var_ref]/ident[@value="use_inline_resources"]')
7
+ end
8
+ matches
9
+ end
10
+ provider do |ast|
11
+ ast.xpath('//*[self::vcall or self::var_ref]/ident[@value="use_inline_resources"]')
12
+ end
13
+ end
@@ -0,0 +1,32 @@
1
+ rule "FC114", "Cookbook uses legacy Ohai config syntax" do
2
+ tags %w{chef13 deprecated}
3
+ recipe do |ast|
4
+ # Ohai::Config[:something]
5
+ #
6
+ # <aref value="aref"> <-- if assigning this will be aref_field
7
+ # <const_path_ref value="const_path_ref">
8
+ # <var_ref value="var_ref">
9
+ # <const value="Ohai">
10
+ # <pos line="3" column="0"/>
11
+ # </const>
12
+ # </var_ref>
13
+ # <const value="Config">
14
+ # <pos line="3" column="6"/>
15
+ # </const>
16
+ # </const_path_ref>
17
+ # <args_add_block value="false">
18
+ # <args_add value="args_add">
19
+ # <args_new value="args_new"/>
20
+ # <symbol_literal value="symbol_literal">
21
+ # <symbol value="symbol">
22
+ # <ident value="something">
23
+ # <pos line="3" column="14"/>
24
+ # </ident>
25
+ # </symbol>
26
+ # </symbol_literal>
27
+ # </args_add>
28
+ # </args_add_block>
29
+ # </aref>
30
+ ast.xpath('//*[self::aref or self::aref_field][const_path_ref/const/@value="Config"][const_path_ref/var_ref/const/@value="Ohai"][args_add_block/args_add/symbol_literal/symbol]')
31
+ end
32
+ end
@@ -1,4 +1,4 @@
1
1
  module FoodCritic
2
2
  # The current version of foodcritic
3
- VERSION = "12.2.2"
3
+ VERSION = "12.3.0"
4
4
  end
@@ -0,0 +1,21 @@
1
+ require "spec_helper"
2
+
3
+ describe "FC110" do
4
+ context "with a cookbook with a script resource that uses command" do
5
+ resource_file <<-EOF
6
+ bash 'foo' do
7
+ command 'cat /etc/passwd'
8
+ end
9
+ EOF
10
+ it { is_expected.to violate_rule }
11
+ end
12
+
13
+ context "with a cookbook with a script resource that uses code" do
14
+ resource_file <<-EOF
15
+ bash 'foo' do
16
+ code 'cat /etc/passwd'
17
+ end
18
+ EOF
19
+ it { is_expected.not_to violate_rule }
20
+ end
21
+ end
@@ -0,0 +1,17 @@
1
+ require "spec_helper"
2
+
3
+ describe "FC111" do
4
+ context "with a cookbook with a search that uses the deprecated sort flag" do
5
+ resource_file <<-EOF
6
+ search(:node, 'role:web', :sort => true)
7
+ EOF
8
+ it { is_expected.to violate_rule }
9
+ end
10
+
11
+ context "with a cookbook with a search that does not use sort" do
12
+ resource_file <<-EOF
13
+ search(:node, 'role:web')
14
+ EOF
15
+ it { is_expected.not_to violate_rule }
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ require "spec_helper"
2
+
3
+ describe "FC112" do
4
+ context "with a cookbook with a resource that uses dsl_name" do
5
+ library_file <<-EOF
6
+ my_resource = MyResource.dsl_name
7
+ EOF
8
+ it { is_expected.to violate_rule }
9
+ end
10
+
11
+ context "with a cookbook with a resource that uses resource_name" do
12
+ library_file <<-EOF
13
+ my_resource = MyResource.resource_name
14
+ EOF
15
+ it { is_expected.not_to violate_rule }
16
+ end
17
+ end
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe "FC057" do
3
+ describe "FC113" do
4
4
  context "with a cookbook with a library provider with use_inline_resources" do
5
5
  library_file <<-EOF
6
6
  class MyResources
@@ -24,7 +24,7 @@ describe "FC057" do
24
24
  end
25
25
  end
26
26
  EOF
27
- it { is_expected.not_to violate_rule }
27
+ it { is_expected.to violate_rule }
28
28
  end
29
29
 
30
30
  context "with a cookbook with a library provider without use_inline_resources" do
@@ -48,7 +48,7 @@ describe "FC057" do
48
48
  end
49
49
  end
50
50
  EOF
51
- it { is_expected.to violate_rule }
51
+ it { is_expected.not_to violate_rule }
52
52
  end
53
53
 
54
54
  context "with a cookbook with plain old library file" do
@@ -59,4 +59,40 @@ describe "FC057" do
59
59
  EOF
60
60
  it { is_expected.not_to violate_rule }
61
61
  end
62
+
63
+ context "with a cookbook with LWRP not using use_inline_resources" do
64
+ provider_file <<-EOF
65
+ action :create do
66
+ template "/etc/something.conf" do
67
+ notifies :restart, "service[something]"
68
+ end
69
+ end
70
+ EOF
71
+ it { is_expected.not_to violate_rule }
72
+ end
73
+
74
+ context "with a cookbook with LWRP using use_inline_resources" do
75
+ provider_file <<-EOF
76
+ use_inline_resources
77
+
78
+ action :create do
79
+ template "/etc/something.conf" do
80
+ notifies :restart, "service[something]"
81
+ end
82
+ end
83
+ EOF
84
+ it { is_expected.to violate_rule }
85
+ end
86
+
87
+ context "with a cookbook ignoring the rule" do
88
+ provider_file <<-EOF.gsub(/^ /, "") # When we drop 2.2 support, this can use <<~EOF.
89
+ # ~FC059
90
+ action :create do
91
+ template "/etc/something.conf" do
92
+ notifies :restart, "service[something]"
93
+ end
94
+ end
95
+ EOF
96
+ it { is_expected.not_to violate_rule }
97
+ end
62
98
  end
@@ -0,0 +1,31 @@
1
+ require "spec_helper"
2
+
3
+ describe "FC114" do
4
+ context "with a cookbook that uses the legacy Ohai config" do
5
+ library_file <<-EOF
6
+ Ohai::Config[:something]
7
+ EOF
8
+ it { is_expected.to violate_rule }
9
+ end
10
+
11
+ context "with a cookbook that sets the legacy Ohai config value" do
12
+ library_file <<-EOF
13
+ Ohai::Config[:something] = 'something'
14
+ EOF
15
+ it { is_expected.to violate_rule }
16
+ end
17
+
18
+ context "with a cookbook that uses the new full form Ohai config" do
19
+ library_file <<-EOF
20
+ Ohai::Config.ohai[:something] = 'something'
21
+ EOF
22
+ it { is_expected.not_to violate_rule }
23
+ end
24
+
25
+ context "with a cookbook that uses the new short form Ohai config" do
26
+ library_file <<-EOF
27
+ Ohai.config[:something] = 'something'
28
+ EOF
29
+ it { is_expected.not_to violate_rule }
30
+ end
31
+ end
@@ -2,3 +2,22 @@ FC009: Resource attribute not recognised: ./recipes/default.rb:1
2
2
  FC069: Ensure standardized license defined in metadata: ./metadata.rb:1
3
3
  FC078: Ensure cookbook shared under an OSI-approved open source license: ./metadata.rb:1
4
4
  FC080: User resource uses deprecated supports property: ./recipes/default.rb:8
5
+ FC113: Resource declares deprecated use_inline_resources: ./providers/altdisk.rb:23
6
+ FC113: Resource declares deprecated use_inline_resources: ./providers/bootlist.rb:24
7
+ FC113: Resource declares deprecated use_inline_resources: ./providers/chdev.rb:23
8
+ FC113: Resource declares deprecated use_inline_resources: ./providers/chsec.rb:23
9
+ FC113: Resource declares deprecated use_inline_resources: ./providers/etchosts.rb:22
10
+ FC113: Resource declares deprecated use_inline_resources: ./providers/fixes.rb:23
11
+ FC113: Resource declares deprecated use_inline_resources: ./providers/inittab.rb:24
12
+ FC113: Resource declares deprecated use_inline_resources: ./providers/multibos.rb:22
13
+ FC113: Resource declares deprecated use_inline_resources: ./providers/nimclient.rb:21
14
+ FC113: Resource declares deprecated use_inline_resources: ./providers/niminit.rb:20
15
+ FC113: Resource declares deprecated use_inline_resources: ./providers/no.rb:23
16
+ FC113: Resource declares deprecated use_inline_resources: ./providers/pagingspace.rb:23
17
+ FC113: Resource declares deprecated use_inline_resources: ./providers/subserver.rb:24
18
+ FC113: Resource declares deprecated use_inline_resources: ./providers/subsystem.rb:13
19
+ FC113: Resource declares deprecated use_inline_resources: ./providers/tcpservice.rb:24
20
+ FC113: Resource declares deprecated use_inline_resources: ./providers/toolboxpackage.rb:23
21
+ FC113: Resource declares deprecated use_inline_resources: ./providers/tunables.rb:23
22
+ FC113: Resource declares deprecated use_inline_resources: ./providers/volume_group.rb:5
23
+ FC113: Resource declares deprecated use_inline_resources: ./providers/wpar.rb:24
@@ -1,9 +1,6 @@
1
- FC017: LWRP does not notify when updated: ./providers/repository.rb:124
2
1
  FC043: Prefer new notification syntax: ./providers/repository.rb:112
3
2
  FC043: Prefer new notification syntax: ./recipes/default.rb:48
4
3
  FC048: Prefer Mixlib::ShellOut: ./providers/repository.rb:26
5
- FC059: LWRP provider does not declare use_inline_resources: ./providers/preference.rb:1
6
- FC059: LWRP provider does not declare use_inline_resources: ./providers/repository.rb:1
7
4
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
8
5
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
9
6
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,2 +1,3 @@
1
1
  FC069: Ensure standardized license defined in metadata: ./metadata.rb:1
2
2
  FC078: Ensure cookbook shared under an OSI-approved open source license: ./metadata.rb:1
3
+ FC113: Resource declares deprecated use_inline_resources: ./providers/default.rb:25
@@ -1,6 +1,2 @@
1
- FC017: LWRP does not notify when updated: ./providers/builtins.rb:22
2
- FC017: LWRP does not notify when updated: ./providers/ruleset.rb:21
3
- FC059: LWRP provider does not declare use_inline_resources: ./providers/builtins.rb:1
4
- FC059: LWRP provider does not declare use_inline_resources: ./providers/ruleset.rb:1
5
1
  FC069: Ensure standardized license defined in metadata: ./metadata.rb:1
6
2
  FC078: Ensure cookbook shared under an OSI-approved open source license: ./metadata.rb:1
@@ -1,7 +1,3 @@
1
- FC059: LWRP provider does not declare use_inline_resources: ./providers/ebs_volume.rb:1
2
- FC059: LWRP provider does not declare use_inline_resources: ./providers/elastic_ip.rb:1
3
- FC059: LWRP provider does not declare use_inline_resources: ./providers/elastic_lb.rb:1
4
- FC059: LWRP provider does not declare use_inline_resources: ./providers/resource_tag.rb:1
5
1
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
6
2
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
7
3
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,4 +1,3 @@
1
- FC059: LWRP provider does not declare use_inline_resources: ./providers/service.rb:1
2
1
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
3
2
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
4
3
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -2,3 +2,4 @@ FC067: Ensure at least one platform supported in metadata: ./metadata.rb:1
2
2
  FC069: Ensure standardized license defined in metadata: ./metadata.rb:1
3
3
  FC078: Ensure cookbook shared under an OSI-approved open source license: ./metadata.rb:1
4
4
  FC109: Use platform-specific package resources instead of provider property: ./libraries/default_handler.rb:52
5
+ FC113: Resource declares deprecated use_inline_resources: ./libraries/chef_ingredient_provider.rb:26
@@ -4,3 +4,4 @@ FC069: Ensure standardized license defined in metadata: ./metadata.rb:1
4
4
  FC078: Ensure cookbook shared under an OSI-approved open source license: ./metadata.rb:1
5
5
  FC085: Resource using new_resource.updated_by_last_action to converge resource: ./libraries/chef_vault_secret.rb:92
6
6
  FC086: Use databag helper methods to load data bag items: ./libraries/helpers.rb:39
7
+ FC113: Resource declares deprecated use_inline_resources: ./libraries/chef_vault_secret.rb:49
@@ -1,4 +1,3 @@
1
- FC059: LWRP provider does not declare use_inline_resources: ./providers/default.rb:1
2
1
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
3
2
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
4
3
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,5 +1,3 @@
1
- FC017: LWRP does not notify when updated: ./providers/d.rb:1
2
- FC059: LWRP provider does not declare use_inline_resources: ./providers/d.rb:1
3
1
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
4
2
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
5
3
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,10 +1,8 @@
1
1
  FC001: Use strings in preference to symbols to access node attributes: ./attributes/default.rb:19
2
2
  FC001: Use strings in preference to symbols to access node attributes: ./attributes/default.rb:20
3
- FC017: LWRP does not notify when updated: ./providers/package.rb:27
4
3
  FC048: Prefer Mixlib::ShellOut: ./providers/package.rb:44
5
4
  FC048: Prefer Mixlib::ShellOut: ./providers/package.rb:47
6
5
  FC048: Prefer Mixlib::ShellOut: ./providers/package.rb:76
7
- FC059: LWRP provider does not declare use_inline_resources: ./providers/package.rb:1
8
6
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
9
7
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
10
8
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -21,7 +21,6 @@ FC019: Access node attributes in a consistent manner: ./recipes/ec2.rb:25
21
21
  FC019: Access node attributes in a consistent manner: ./recipes/ec2.rb:26
22
22
  FC019: Access node attributes in a consistent manner: ./recipes/ec2.rb:40
23
23
  FC043: Prefer new notification syntax: ./recipes/ec2.rb:69
24
- FC059: LWRP provider does not declare use_inline_resources: ./providers/rr.rb:1
25
24
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
26
25
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
27
26
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,8 +1,3 @@
1
- FC017: LWRP does not notify when updated: ./providers/rule_ufw.rb:23
2
- FC017: LWRP does not notify when updated: ./providers/rule_ufw.rb:27
3
- FC017: LWRP does not notify when updated: ./providers/rule_ufw.rb:31
4
- FC059: LWRP provider does not declare use_inline_resources: ./providers/rule_ufw.rb:1
5
- FC059: LWRP provider does not declare use_inline_resources: ./providers/ufw.rb:1
6
1
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
7
2
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
8
3
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,5 +1,3 @@
1
- FC059: LWRP provider does not declare use_inline_resources: ./providers/config.rb:1
2
- FC059: LWRP provider does not declare use_inline_resources: ./providers/install.rb:1
3
1
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
4
2
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
5
3
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,7 +1,4 @@
1
1
  FC016: LWRP does not declare a default action: ./resources/ipaddr.rb:1
2
- FC017: LWRP does not notify when updated: ./providers/default.rb:20
3
- FC059: LWRP provider does not declare use_inline_resources: ./providers/default.rb:1
4
- FC059: LWRP provider does not declare use_inline_resources: ./providers/null.rb:1
5
2
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
6
3
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
7
4
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,6 +1,3 @@
1
- FC017: LWRP does not notify when updated: ./providers/tap.rb:13
2
- FC017: LWRP does not notify when updated: ./providers/tap.rb:21
3
- FC059: LWRP provider does not declare use_inline_resources: ./providers/tap.rb:1
4
1
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
5
2
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
6
3
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,25 +1,4 @@
1
1
  FC002: Avoid string interpolation where not required: ./providers/site.rb:36
2
- FC017: LWRP does not notify when updated: ./providers/app.rb:26
3
- FC017: LWRP does not notify when updated: ./providers/app.rb:40
4
- FC017: LWRP does not notify when updated: ./providers/app.rb:57
5
- FC017: LWRP does not notify when updated: ./providers/config.rb:27
6
- FC017: LWRP does not notify when updated: ./providers/pool.rb:27
7
- FC017: LWRP does not notify when updated: ./providers/pool.rb:41
8
- FC017: LWRP does not notify when updated: ./providers/pool.rb:68
9
- FC017: LWRP does not notify when updated: ./providers/pool.rb:78
10
- FC017: LWRP does not notify when updated: ./providers/pool.rb:88
11
- FC017: LWRP does not notify when updated: ./providers/pool.rb:98
12
- FC017: LWRP does not notify when updated: ./providers/pool.rb:106
13
- FC017: LWRP does not notify when updated: ./providers/site.rb:26
14
- FC017: LWRP does not notify when updated: ./providers/site.rb:50
15
- FC017: LWRP does not notify when updated: ./providers/site.rb:84
16
- FC017: LWRP does not notify when updated: ./providers/site.rb:94
17
- FC017: LWRP does not notify when updated: ./providers/site.rb:104
18
- FC017: LWRP does not notify when updated: ./providers/site.rb:114
19
- FC059: LWRP provider does not declare use_inline_resources: ./providers/app.rb:1
20
- FC059: LWRP provider does not declare use_inline_resources: ./providers/config.rb:1
21
- FC059: LWRP provider does not declare use_inline_resources: ./providers/pool.rb:1
22
- FC059: LWRP provider does not declare use_inline_resources: ./providers/site.rb:1
23
2
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
24
3
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
25
4
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,4 +1,3 @@
1
- FC059: LWRP provider does not declare use_inline_resources: ./providers/file.rb:1
2
1
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
3
2
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
4
3
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,8 +1,4 @@
1
1
  FC014: Consider extracting long ruby_block to library: ./providers/logical_volume.rb:18
2
- FC017: LWRP does not notify when updated: ./providers/physical_volume.rb:6
3
- FC059: LWRP provider does not declare use_inline_resources: ./providers/logical_volume.rb:1
4
- FC059: LWRP provider does not declare use_inline_resources: ./providers/physical_volume.rb:1
5
- FC059: LWRP provider does not declare use_inline_resources: ./providers/volume_group.rb:1
6
2
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
7
3
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
8
4
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,7 +1,4 @@
1
- FC017: LWRP does not notify when updated: ./providers/default.rb:61
2
- FC017: LWRP does not notify when updated: ./providers/default.rb:65
3
1
  FC045: Metadata does not contain cookbook name: ./metadata.rb:1
4
- FC059: LWRP provider does not declare use_inline_resources: ./providers/default.rb:1
5
2
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
6
3
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
7
4
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -5,3 +5,5 @@ FC067: Ensure at least one platform supported in metadata: ./metadata.rb:1
5
5
  FC069: Ensure standardized license defined in metadata: ./metadata.rb:1
6
6
  FC072: Metadata should not contain "attribute" keyword: ./metadata.rb:1
7
7
  FC078: Ensure cookbook shared under an OSI-approved open source license: ./metadata.rb:1
8
+ FC114: Cookbook uses legacy Ohai config syntax: ./recipes/default.rb:20
9
+ FC114: Cookbook uses legacy Ohai config syntax: ./recipes/default.rb:21
@@ -1,8 +1,3 @@
1
- FC017: LWRP does not notify when updated: ./providers/pear_channel.rb:31
2
- FC017: LWRP does not notify when updated: ./providers/pear_channel.rb:40
3
- FC017: LWRP does not notify when updated: ./providers/pear_channel.rb:69
4
- FC059: LWRP provider does not declare use_inline_resources: ./providers/pear.rb:1
5
- FC059: LWRP provider does not declare use_inline_resources: ./providers/pear_channel.rb:1
6
1
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
7
2
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
8
3
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,6 +1,4 @@
1
- FC017: LWRP does not notify when updated: ./providers/default.rb:19
2
1
  FC019: Access node attributes in a consistent manner: ./recipes/default.rb:69
3
- FC059: LWRP provider does not declare use_inline_resources: ./providers/default.rb:1
4
2
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
5
3
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
6
4
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,8 +1,5 @@
1
1
  FC011: Missing README in markdown format: examples/README.md:1
2
- FC017: LWRP does not notify when updated: ./providers/serve.rb:65
3
- FC017: LWRP does not notify when updated: ./providers/serve.rb:69
4
2
  FC031: Cookbook without metadata.rb file: examples/metadata.rb:1
5
- FC059: LWRP provider does not declare use_inline_resources: ./providers/serve.rb:1
6
3
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
7
4
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
8
5
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,3 +1,4 @@
1
1
  FC004: Use a service resource to start and stop services: ./recipes/default.rb:24
2
2
  FC069: Ensure standardized license defined in metadata: ./metadata.rb:1
3
3
  FC078: Ensure cookbook shared under an OSI-approved open source license: ./metadata.rb:1
4
+ FC113: Resource declares deprecated use_inline_resources: ./libraries/provider_runit_service.rb:42
@@ -1,4 +1,3 @@
1
- FC059: LWRP provider does not declare use_inline_resources: ./providers/target.rb:1
2
1
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
3
2
  FC069: Ensure standardized license defined in metadata: ./metadata.rb:1
4
3
  FC078: Ensure cookbook shared under an OSI-approved open source license: ./metadata.rb:1
@@ -1,5 +1,3 @@
1
- FC017: LWRP does not notify when updated: ./providers/default.rb:102
2
- FC059: LWRP provider does not declare use_inline_resources: ./providers/default.rb:1
3
1
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
4
2
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
5
3
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -6,3 +6,5 @@ FC069: Ensure standardized license defined in metadata: ./metadata.rb:1
6
6
  FC071: Missing LICENSE file: ./LICENSE:1
7
7
  FC074: LWRP should use DSL to define resource's default action: ./resources/package.rb:1
8
8
  FC078: Ensure cookbook shared under an OSI-approved open source license: ./metadata.rb:1
9
+ FC113: Resource declares deprecated use_inline_resources: ./providers/extract.rb:26
10
+ FC113: Resource declares deprecated use_inline_resources: ./providers/package.rb:22
@@ -2,7 +2,6 @@ FC016: LWRP does not declare a default action: ./resources/torrent_file.rb:1
2
2
  FC024: Consider adding platform equivalents: ./recipes/default.rb:42
3
3
  FC025: Prefer chef_gem to compile-time gem install: ./recipes/default.rb:25
4
4
  FC025: Prefer chef_gem to compile-time gem install: ./recipes/default.rb:31
5
- FC059: LWRP provider does not declare use_inline_resources: ./providers/torrent_file.rb:1
6
5
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
7
6
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
8
7
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,6 +1,5 @@
1
1
  FC009: Resource attribute not recognised: ./providers/manage.rb:78
2
2
  FC047: Attribute assignment does not specify precedence: ./providers/manage.rb:55
3
- FC059: LWRP provider does not declare use_inline_resources: ./providers/manage.rb:1
4
3
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
5
4
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
6
5
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,5 +1,3 @@
1
- FC017: LWRP does not notify when updated: ./providers/product.rb:26
2
- FC059: LWRP provider does not declare use_inline_resources: ./providers/product.rb:1
3
1
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
4
2
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
5
3
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -2,42 +2,8 @@ FC002: Avoid string interpolation where not required: ./libraries/registry_helpe
2
2
  FC002: Avoid string interpolation where not required: ./libraries/registry_helper.rb:173
3
3
  FC002: Avoid string interpolation where not required: ./libraries/windows_privileged.rb:42
4
4
  FC002: Avoid string interpolation where not required: ./libraries/windows_privileged.rb:56
5
- FC017: LWRP does not notify when updated: ./providers/auto_run.rb:21
6
- FC017: LWRP does not notify when updated: ./providers/auto_run.rb:27
7
- FC017: LWRP does not notify when updated: ./providers/batch.rb:24
8
- FC017: LWRP does not notify when updated: ./providers/package.rb:35
9
- FC017: LWRP does not notify when updated: ./providers/package.rb:53
10
- FC017: LWRP does not notify when updated: ./providers/package.rb:64
11
- FC017: LWRP does not notify when updated: ./providers/pagefile.rb:24
12
- FC017: LWRP does not notify when updated: ./providers/pagefile.rb:66
13
- FC017: LWRP does not notify when updated: ./providers/path.rb:21
14
- FC017: LWRP does not notify when updated: ./providers/path.rb:29
15
- FC017: LWRP does not notify when updated: ./providers/reboot.rb:21
16
- FC017: LWRP does not notify when updated: ./providers/reboot.rb:27
17
- FC017: LWRP does not notify when updated: ./providers/registry.rb:27
18
- FC017: LWRP does not notify when updated: ./providers/registry.rb:31
19
- FC017: LWRP does not notify when updated: ./providers/registry.rb:35
20
- FC017: LWRP does not notify when updated: ./providers/registry.rb:61
21
- FC017: LWRP does not notify when updated: ./providers/task.rb:24
22
- FC017: LWRP does not notify when updated: ./providers/task.rb:43
23
- FC017: LWRP does not notify when updated: ./providers/task.rb:58
24
- FC017: LWRP does not notify when updated: ./providers/task.rb:75
25
- FC017: LWRP does not notify when updated: ./providers/zipfile.rb:27
26
- FC017: LWRP does not notify when updated: ./providers/zipfile.rb:44
27
5
  FC018: LWRP uses deprecated notification syntax: ./providers/shortcut.rb:54
28
6
  FC048: Prefer Mixlib::ShellOut: ./providers/task.rb:106
29
- FC059: LWRP provider does not declare use_inline_resources: ./providers/auto_run.rb:1
30
- FC059: LWRP provider does not declare use_inline_resources: ./providers/batch.rb:1
31
- FC059: LWRP provider does not declare use_inline_resources: ./providers/feature_dism.rb:1
32
- FC059: LWRP provider does not declare use_inline_resources: ./providers/feature_servermanagercmd.rb:1
33
- FC059: LWRP provider does not declare use_inline_resources: ./providers/package.rb:1
34
- FC059: LWRP provider does not declare use_inline_resources: ./providers/pagefile.rb:1
35
- FC059: LWRP provider does not declare use_inline_resources: ./providers/path.rb:1
36
- FC059: LWRP provider does not declare use_inline_resources: ./providers/reboot.rb:1
37
- FC059: LWRP provider does not declare use_inline_resources: ./providers/registry.rb:1
38
- FC059: LWRP provider does not declare use_inline_resources: ./providers/shortcut.rb:1
39
- FC059: LWRP provider does not declare use_inline_resources: ./providers/task.rb:1
40
- FC059: LWRP provider does not declare use_inline_resources: ./providers/zipfile.rb:1
41
7
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
42
8
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
43
9
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -1,12 +1,7 @@
1
1
  FC009: Resource attribute not recognised: ./recipes/epel.rb:27
2
- FC017: LWRP does not notify when updated: ./providers/key.rb:25
3
- FC017: LWRP does not notify when updated: ./providers/repository.rb:28
4
- FC017: LWRP does not notify when updated: ./providers/repository.rb:45
5
2
  FC038: Invalid resource action: ./recipes/epel.rb:27
6
3
  FC043: Prefer new notification syntax: ./providers/key.rb:60
7
4
  FC043: Prefer new notification syntax: ./providers/repository.rb:94
8
- FC059: LWRP provider does not declare use_inline_resources: ./providers/key.rb:1
9
- FC059: LWRP provider does not declare use_inline_resources: ./providers/repository.rb:1
10
5
  FC064: Ensure issues_url is set in metadata: ./metadata.rb:1
11
6
  FC065: Ensure source_url is set in metadata: ./metadata.rb:1
12
7
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
@@ -402,7 +402,11 @@ describe FoodCritic::Api do
402
402
  it "returns empty unless the ast supports XPath" do
403
403
  expect(api.find_resources(nil)).to be_empty
404
404
  end
405
- it "restricts by resource type when provided" do
405
+ it "restricts by resource type when provided an array" do
406
+ expect(ast).to receive(:xpath).with("//method_add_block[command/ident[@value='file' or @value='template']][command/ident/@value != 'action']").and_return(["method_add_block"])
407
+ api.find_resources(ast, :type => %w{file template})
408
+ end
409
+ it "restricts by resource type when provided a string" do
406
410
  expect(ast).to receive(:xpath).with("//method_add_block[command/ident[@value='file']][command/ident/@value != 'action']").and_return(["method_add_block"])
407
411
  api.find_resources(ast, :type => "file")
408
412
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foodcritic
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.2.2
4
+ version: 12.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Crump
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-14 00:00:00.000000000 Z
11
+ date: 2018-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber-core
@@ -187,7 +187,6 @@ files:
187
187
  - features/006_check_file_mode.feature
188
188
  - features/009_check_for_unrecognised_resource_attributes.feature
189
189
  - features/014_check_for_long_ruby_blocks.feature
190
- - features/017_check_for_no_lwrp_notifications.feature
191
190
  - features/018_check_for_old_lwrp_notification_syntax.feature
192
191
  - features/019_check_for_consistent_node_access.feature
193
192
  - features/021_check_for_dodgy_lwrp_conditions.feature
@@ -256,7 +255,6 @@ files:
256
255
  - lib/foodcritic/rules/fc014.rb
257
256
  - lib/foodcritic/rules/fc015.rb
258
257
  - lib/foodcritic/rules/fc016.rb
259
- - lib/foodcritic/rules/fc017.rb
260
258
  - lib/foodcritic/rules/fc018.rb
261
259
  - lib/foodcritic/rules/fc019.rb
262
260
  - lib/foodcritic/rules/fc021.rb
@@ -291,9 +289,7 @@ files:
291
289
  - lib/foodcritic/rules/fc053.rb
292
290
  - lib/foodcritic/rules/fc055.rb
293
291
  - lib/foodcritic/rules/fc056.rb
294
- - lib/foodcritic/rules/fc057.rb
295
292
  - lib/foodcritic/rules/fc058.rb
296
- - lib/foodcritic/rules/fc059.rb
297
293
  - lib/foodcritic/rules/fc060.rb
298
294
  - lib/foodcritic/rules/fc061.rb
299
295
  - lib/foodcritic/rules/fc062.rb
@@ -343,6 +339,11 @@ files:
343
339
  - lib/foodcritic/rules/fc107.rb
344
340
  - lib/foodcritic/rules/fc108.rb
345
341
  - lib/foodcritic/rules/fc109.rb
342
+ - lib/foodcritic/rules/fc110.rb
343
+ - lib/foodcritic/rules/fc111.rb
344
+ - lib/foodcritic/rules/fc112.rb
345
+ - lib/foodcritic/rules/fc113.rb
346
+ - lib/foodcritic/rules/fc114.rb
346
347
  - lib/foodcritic/template.rb
347
348
  - lib/foodcritic/version.rb
348
349
  - lib/foodcritic/xml.rb
@@ -373,9 +374,7 @@ files:
373
374
  - spec/functional/fc053_spec.rb
374
375
  - spec/functional/fc055_spec.rb
375
376
  - spec/functional/fc056_spec.rb
376
- - spec/functional/fc057_spec.rb
377
377
  - spec/functional/fc058_spec.rb
378
- - spec/functional/fc059_spec.rb
379
378
  - spec/functional/fc060_spec.rb
380
379
  - spec/functional/fc061_spec.rb
381
380
  - spec/functional/fc062_spec.rb
@@ -425,6 +424,11 @@ files:
425
424
  - spec/functional/fc107_spec.rb
426
425
  - spec/functional/fc108_spec.rb
427
426
  - spec/functional/fc109_spec.rb
427
+ - spec/functional/fc110_spec.rb
428
+ - spec/functional/fc111_spec.rb
429
+ - spec/functional/fc112_spec.rb
430
+ - spec/functional/fc113_spec.rb
431
+ - spec/functional/fc114_spec.rb
428
432
  - spec/functional/root_aliases_spec.rb
429
433
  - spec/regression/cookbooks.txt
430
434
  - spec/regression/expected/activemq.txt
@@ -538,8 +542,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
538
542
  version: '0'
539
543
  requirements: []
540
544
  rubyforge_project:
541
- rubygems_version: 2.6.13
545
+ rubygems_version: 2.7.3
542
546
  signing_key:
543
547
  specification_version: 4
544
- summary: foodcritic-12.2.2
548
+ summary: foodcritic-12.3.0
545
549
  test_files: []
@@ -1,50 +0,0 @@
1
- Feature: Check for no LWRP notifications
2
-
3
- In order to ensure resource actions are triggered as expected
4
- As a developer
5
- I want to identify when a LWRP does not trigger notifications
6
-
7
- Scenario: LWRP with no notifications
8
- Given a cookbook that contains a LWRP that does not trigger notifications
9
- When I check the cookbook
10
- Then the LWRP does not notify when updated warning 017 should be displayed against the provider file
11
-
12
- Scenario: LWRP with a notification
13
- Given a cookbook that contains a LWRP with a single notification
14
- When I check the cookbook
15
- Then the LWRP does not notify when updated warning 017 should not be displayed against the provider file
16
-
17
- Scenario: LWRP with a notification without parentheses
18
- Given a cookbook that contains a LWRP with a single notification without parentheses
19
- When I check the cookbook
20
- Then the LWRP does not notify when updated warning 017 should not be displayed against the provider file
21
-
22
- Scenario: LWRP with multiple notifications
23
- Given a cookbook that contains a LWRP with multiple notifications
24
- When I check the cookbook
25
- Then the LWRP does not notify when updated warning 017 should not be displayed against the provider file
26
-
27
- Scenario Outline: LWRP using converge_by
28
- Given a cookbook that contains a LWRP that uses converge_by - <block_type> block <with_parens> parentheses
29
- When I check the cookbook
30
- Then the LWRP does not notify when updated warning 017 should not be displayed against the provider file
31
- Examples:
32
- | block_type | with_parens |
33
- | brace | with |
34
- | do | with |
35
- | do | without |
36
-
37
- Scenario: LWRP using use_inline_resources
38
- Given a cookbook that contains a LWRP that uses use_inline_resources
39
- When I check the cookbook
40
- Then the LWRP does not notify when updated warning 017 should not be displayed against the provider file
41
-
42
- Scenario Outline: Warnings raised for actions individually
43
- Given a LWRP with an action :create that notifies with <notify_type> and another :delete that does not notify
44
- When I check the cookbook
45
- Then the LWRP does not notify when updated warning 017 should not be shown against the :create action
46
- And the LWRP does not notify when updated warning 017 should be shown against the :delete action
47
- Examples:
48
- | notify_type |
49
- | converge_by |
50
- | updated_by_last_action |
@@ -1,29 +0,0 @@
1
- rule "FC017", "LWRP does not notify when updated" do
2
- tags %w{correctness lwrp}
3
- provider do |ast, filename|
4
-
5
- use_inline_resources = !ast.xpath('//*[self::vcall or self::var_ref]/ident
6
- [@value="use_inline_resources"]').empty?
7
-
8
- unless use_inline_resources
9
- actions = ast.xpath('//method_add_block/command[ident/@value="action"]/
10
- args_add_block/descendant::symbol/ident')
11
-
12
- actions.reject do |action|
13
- blk = action.xpath('ancestor::command[1]/
14
- following-sibling::*[self::do_block or self::brace_block]')
15
- empty = !blk.xpath("stmts_add/void_stmt").empty?
16
- converge_by = !blk.xpath('descendant::*[self::command or self::fcall]
17
- /ident[@value="converge_by"]').empty?
18
-
19
- updated_by_last_action = !blk.xpath('descendant::*[self::call or
20
- self::command_call]/*[self::vcall or self::var_ref/ident/
21
- @value="new_resource"]/../ident[@value="updated_by_last_action"]
22
- ').empty?
23
-
24
- empty || converge_by || updated_by_last_action
25
- end
26
- end
27
-
28
- end
29
- end
@@ -1,8 +0,0 @@
1
- rule "FC057", "Library provider does not declare use_inline_resources" do
2
- tags %w{correctness lwrp}
3
- library do |ast|
4
- ast.xpath('//const_path_ref/const[@value="LWRPBase"]/..//const[@value="Provider"]/../../..').select do |x|
5
- x.xpath('//*[self::vcall or self::var_ref]/ident[@value="use_inline_resources"]').empty?
6
- end
7
- end
8
- end
@@ -1,10 +0,0 @@
1
- rule "FC059", "LWRP provider does not declare use_inline_resources" do
2
- tags %w{correctness lwrp}
3
- provider do |ast, filename|
4
- use_inline_resources = !ast.xpath('//*[self::vcall or self::var_ref]/ident
5
- [@value="use_inline_resources"]').empty?
6
- unless use_inline_resources
7
- [file_match(filename)]
8
- end
9
- end
10
- end
@@ -1,39 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "FC059" do
4
- context "with a cookbook with LWRP not using use_inline_resources" do
5
- provider_file <<-EOF
6
- action :create do
7
- template "/etc/something.conf" do
8
- notifies :restart, "service[something]"
9
- end
10
- end
11
- EOF
12
- it { is_expected.to violate_rule }
13
- end
14
-
15
- context "with a cookbook with LWRP using use_inline_resources" do
16
- provider_file <<-EOF
17
- use_inline_resources
18
-
19
- action :create do
20
- template "/etc/something.conf" do
21
- notifies :restart, "service[something]"
22
- end
23
- end
24
- EOF
25
- it { is_expected.not_to violate_rule }
26
- end
27
-
28
- context "with a cookbook ignoring the rule" do
29
- provider_file <<-EOF.gsub(/^ /, "") # When we drop 2.2 support, this can use <<~EOF.
30
- # ~FC059
31
- action :create do
32
- template "/etc/something.conf" do
33
- notifies :restart, "service[something]"
34
- end
35
- end
36
- EOF
37
- it { is_expected.not_to violate_rule }
38
- end
39
- end