foodcritic 15.0.0 → 15.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. checksums.yaml +4 -4
  2. data/chef_dsl_metadata/{chef_14.7.17.json → chef_14.8.12.json} +61 -1
  3. data/foodcritic.gemspec +1 -3
  4. data/lib/foodcritic/linter.rb +1 -1
  5. data/lib/foodcritic/version.rb +1 -1
  6. metadata +5 -232
  7. data/Rakefile +0 -73
  8. data/features/002_check_string_interpolation.feature +0 -50
  9. data/features/005_check_for_resource_repetition.feature +0 -64
  10. data/features/006_check_file_mode.feature +0 -36
  11. data/features/009_check_for_unrecognised_resource_attributes.feature +0 -55
  12. data/features/014_check_for_long_ruby_blocks.feature +0 -30
  13. data/features/018_check_for_old_lwrp_notification_syntax.feature +0 -25
  14. data/features/019_check_for_consistent_node_access.feature +0 -108
  15. data/features/021_check_for_dodgy_lwrp_conditions.feature +0 -28
  16. data/features/022_check_for_dodgy_conditions_within_loop.feature +0 -43
  17. data/features/024_check_for_missing_platforms.feature +0 -43
  18. data/features/027_check_for_internal_attribute_use.feature +0 -22
  19. data/features/030_check_for_debugger_breakpoints.feature +0 -25
  20. data/features/032_check_for_invalid_notification_timing.feature +0 -24
  21. data/features/033_check_for_missing_template.feature +0 -39
  22. data/features/034_check_for_unused_template_variables.feature +0 -80
  23. data/features/037_check_for_invalid_notification_action.feature +0 -34
  24. data/features/038_check_for_invalid_action.feature +0 -39
  25. data/features/039_check_for_key_access_to_node_methods.feature +0 -33
  26. data/features/044_check_for_bare_attribute_keys.feature +0 -53
  27. data/features/046_check_for_assign_unless_nil_attributes.feature +0 -21
  28. data/features/047_check_for_attribute_assignment_without_precedence.feature +0 -49
  29. data/features/051_check_for_template_partial_loops.feature +0 -40
  30. data/features/build_framework_support.feature +0 -109
  31. data/features/checking_all_types_of_file.feature +0 -40
  32. data/features/choose_rules_to_apply.feature +0 -47
  33. data/features/command_line_help.feature +0 -58
  34. data/features/continuous_integration_support.feature +0 -33
  35. data/features/exclude_paths_to_lint.feature +0 -12
  36. data/features/ignore_via_line_comments.feature +0 -69
  37. data/features/include_custom_rules.feature +0 -29
  38. data/features/individual_file.feature +0 -28
  39. data/features/limit_rules_to_specific_versions.feature +0 -65
  40. data/features/multiple_paths.feature +0 -35
  41. data/features/show_lines_matched.feature +0 -20
  42. data/features/sort_warnings.feature +0 -10
  43. data/features/specify_search_grammar.feature +0 -25
  44. data/features/step_definitions/cookbook_steps.rb +0 -1826
  45. data/features/support/command_helpers.rb +0 -418
  46. data/features/support/cookbook_helpers.rb +0 -599
  47. data/features/support/env.rb +0 -19
  48. data/man/foodcritic.1.ronn +0 -76
  49. data/spec/functional/fc001_spec.rb +0 -72
  50. data/spec/functional/fc004_spec.rb +0 -84
  51. data/spec/functional/fc007_spec.rb +0 -127
  52. data/spec/functional/fc008_spec.rb +0 -33
  53. data/spec/functional/fc009_spec.rb +0 -37
  54. data/spec/functional/fc010_spec.rb +0 -32
  55. data/spec/functional/fc011_spec.rb +0 -20
  56. data/spec/functional/fc013_spec.rb +0 -39
  57. data/spec/functional/fc015_spec.rb +0 -19
  58. data/spec/functional/fc016_spec.rb +0 -57
  59. data/spec/functional/fc025_spec.rb +0 -60
  60. data/spec/functional/fc026_spec.rb +0 -66
  61. data/spec/functional/fc028_spec.rb +0 -93
  62. data/spec/functional/fc029_spec.rb +0 -33
  63. data/spec/functional/fc031_spec.rb +0 -14
  64. data/spec/functional/fc037_spec.rb +0 -75
  65. data/spec/functional/fc038_spec.rb +0 -28
  66. data/spec/functional/fc040_spec.rb +0 -156
  67. data/spec/functional/fc041_spec.rb +0 -121
  68. data/spec/functional/fc042_spec.rb +0 -13
  69. data/spec/functional/fc043_spec.rb +0 -28
  70. data/spec/functional/fc045_spec.rb +0 -18
  71. data/spec/functional/fc048_spec.rb +0 -67
  72. data/spec/functional/fc049_spec.rb +0 -56
  73. data/spec/functional/fc050_spec.rb +0 -85
  74. data/spec/functional/fc052_spec.rb +0 -13
  75. data/spec/functional/fc053_spec.rb +0 -13
  76. data/spec/functional/fc055_spec.rb +0 -18
  77. data/spec/functional/fc056_spec.rb +0 -18
  78. data/spec/functional/fc058_spec.rb +0 -102
  79. data/spec/functional/fc060_spec.rb +0 -45
  80. data/spec/functional/fc061_spec.rb +0 -48
  81. data/spec/functional/fc062_spec.rb +0 -13
  82. data/spec/functional/fc063_spec.rb +0 -18
  83. data/spec/functional/fc064_spec.rb +0 -13
  84. data/spec/functional/fc065_spec.rb +0 -13
  85. data/spec/functional/fc066_spec.rb +0 -33
  86. data/spec/functional/fc067_spec.rb +0 -13
  87. data/spec/functional/fc068_spec.rb +0 -13
  88. data/spec/functional/fc069_spec.rb +0 -38
  89. data/spec/functional/fc070_spec.rb +0 -65
  90. data/spec/functional/fc071_spec.rb +0 -36
  91. data/spec/functional/fc072_spec.rb +0 -13
  92. data/spec/functional/fc073_spec.rb +0 -56
  93. data/spec/functional/fc074_spec.rb +0 -39
  94. data/spec/functional/fc075_spec.rb +0 -41
  95. data/spec/functional/fc076_spec.rb +0 -13
  96. data/spec/functional/fc077_spec.rb +0 -13
  97. data/spec/functional/fc078_spec.rb +0 -35
  98. data/spec/functional/fc079_spec.rb +0 -21
  99. data/spec/functional/fc080_spec.rb +0 -68
  100. data/spec/functional/fc081_spec.rb +0 -25
  101. data/spec/functional/fc082_spec.rb +0 -23
  102. data/spec/functional/fc083_spec.rb +0 -34
  103. data/spec/functional/fc084_spec.rb +0 -49
  104. data/spec/functional/fc085_spec.rb +0 -77
  105. data/spec/functional/fc086_spec.rb +0 -45
  106. data/spec/functional/fc087_spec.rb +0 -43
  107. data/spec/functional/fc088_spec.rb +0 -18
  108. data/spec/functional/fc089_spec.rb +0 -23
  109. data/spec/functional/fc091_spec.rb +0 -38
  110. data/spec/functional/fc092_spec.rb +0 -31
  111. data/spec/functional/fc093_spec.rb +0 -27
  112. data/spec/functional/fc094_spec.rb +0 -18
  113. data/spec/functional/fc095_spec.rb +0 -18
  114. data/spec/functional/fc096_spec.rb +0 -18
  115. data/spec/functional/fc097_spec.rb +0 -18
  116. data/spec/functional/fc098_spec.rb +0 -18
  117. data/spec/functional/fc099_spec.rb +0 -18
  118. data/spec/functional/fc100_spec.rb +0 -18
  119. data/spec/functional/fc101_spec.rb +0 -23
  120. data/spec/functional/fc102_spec.rb +0 -18
  121. data/spec/functional/fc103_spec.rb +0 -30
  122. data/spec/functional/fc104_spec.rb +0 -54
  123. data/spec/functional/fc105_spec.rb +0 -36
  124. data/spec/functional/fc106_spec.rb +0 -21
  125. data/spec/functional/fc107_spec.rb +0 -22
  126. data/spec/functional/fc108_spec.rb +0 -43
  127. data/spec/functional/fc109_spec.rb +0 -22
  128. data/spec/functional/fc110_spec.rb +0 -21
  129. data/spec/functional/fc111_spec.rb +0 -17
  130. data/spec/functional/fc112_spec.rb +0 -17
  131. data/spec/functional/fc113_spec.rb +0 -98
  132. data/spec/functional/fc114_spec.rb +0 -31
  133. data/spec/functional/fc115_spec.rb +0 -24
  134. data/spec/functional/fc116_spec.rb +0 -18
  135. data/spec/functional/fc117_spec.rb +0 -23
  136. data/spec/functional/fc118_spec.rb +0 -17
  137. data/spec/functional/fc119_spec.rb +0 -27
  138. data/spec/functional/fc120_spec.rb +0 -21
  139. data/spec/functional/fc121_spec.rb +0 -45
  140. data/spec/functional/fc122_spec.rb +0 -18
  141. data/spec/functional/root_aliases_spec.rb +0 -13
  142. data/spec/regression/cookbooks.txt +0 -83
  143. data/spec/regression/expected/activemq.txt +0 -6
  144. data/spec/regression/expected/aix.txt +0 -27
  145. data/spec/regression/expected/apparmor.txt +0 -9
  146. data/spec/regression/expected/apt.txt +0 -14
  147. data/spec/regression/expected/ark.txt +0 -3
  148. data/spec/regression/expected/auditd.txt +0 -2
  149. data/spec/regression/expected/aws.txt +0 -16
  150. data/spec/regression/expected/bluepill.txt +0 -12
  151. data/spec/regression/expected/boost.txt +0 -8
  152. data/spec/regression/expected/build-essential.txt +0 -8
  153. data/spec/regression/expected/chef-client.txt +0 -17
  154. data/spec/regression/expected/chef-ingredient.txt +0 -6
  155. data/spec/regression/expected/chef-server.txt +0 -13
  156. data/spec/regression/expected/chef-vault.txt +0 -7
  157. data/spec/regression/expected/chef.txt +0 -104
  158. data/spec/regression/expected/chef_client_updater.txt +0 -2
  159. data/spec/regression/expected/chef_handler.txt +0 -7
  160. data/spec/regression/expected/chef_hostname.txt +0 -3
  161. data/spec/regression/expected/chef_nginx.txt +0 -4
  162. data/spec/regression/expected/cron.txt +0 -7
  163. data/spec/regression/expected/database.txt +0 -42
  164. data/spec/regression/expected/dmg.txt +0 -11
  165. data/spec/regression/expected/docker.txt +0 -4
  166. data/spec/regression/expected/drbd.txt +0 -29
  167. data/spec/regression/expected/dynect.txt +0 -33
  168. data/spec/regression/expected/erlang.txt +0 -6
  169. data/spec/regression/expected/fail2ban.txt +0 -5
  170. data/spec/regression/expected/firewall.txt +0 -11
  171. data/spec/regression/expected/gecode.txt +0 -10
  172. data/spec/regression/expected/gems.txt +0 -32
  173. data/spec/regression/expected/gunicorn.txt +0 -11
  174. data/spec/regression/expected/heartbeat.txt +0 -8
  175. data/spec/regression/expected/homebrew.txt +0 -7
  176. data/spec/regression/expected/iis.txt +0 -22
  177. data/spec/regression/expected/iptables.txt +0 -9
  178. data/spec/regression/expected/jetty.txt +0 -13
  179. data/spec/regression/expected/jpackage.txt +0 -9
  180. data/spec/regression/expected/keepalived.txt +0 -3
  181. data/spec/regression/expected/kickstart.txt +0 -15
  182. data/spec/regression/expected/libarchive.txt +0 -6
  183. data/spec/regression/expected/logwatch.txt +0 -5
  184. data/spec/regression/expected/lvm.txt +0 -14
  185. data/spec/regression/expected/maradns.txt +0 -14
  186. data/spec/regression/expected/maven.txt +0 -8
  187. data/spec/regression/expected/memcached.txt +0 -31
  188. data/spec/regression/expected/motd-tail.txt +0 -5
  189. data/spec/regression/expected/mysql.txt +0 -19
  190. data/spec/regression/expected/ohai.txt +0 -9
  191. data/spec/regression/expected/openldap.txt +0 -12
  192. data/spec/regression/expected/openssh.txt +0 -6
  193. data/spec/regression/expected/openssl.txt +0 -6
  194. data/spec/regression/expected/partial_search.txt +0 -7
  195. data/spec/regression/expected/passenger_apache2.txt +0 -31
  196. data/spec/regression/expected/perl.txt +0 -14
  197. data/spec/regression/expected/php.txt +0 -6
  198. data/spec/regression/expected/postfix.txt +0 -8
  199. data/spec/regression/expected/powershell.txt +0 -8
  200. data/spec/regression/expected/resolver.txt +0 -7
  201. data/spec/regression/expected/rsync.txt +0 -9
  202. data/spec/regression/expected/rsyslog.txt +0 -11
  203. data/spec/regression/expected/runit.txt +0 -4
  204. data/spec/regression/expected/smokeping.txt +0 -6
  205. data/spec/regression/expected/sql_server.txt +0 -7
  206. data/spec/regression/expected/ssh_known_hosts.txt +0 -6
  207. data/spec/regression/expected/stompserver.txt +0 -6
  208. data/spec/regression/expected/subversion.txt +0 -6
  209. data/spec/regression/expected/sudo.txt +0 -10
  210. data/spec/regression/expected/tar.txt +0 -10
  211. data/spec/regression/expected/tftp.txt +0 -6
  212. data/spec/regression/expected/tomcat.txt +0 -18
  213. data/spec/regression/expected/transmission.txt +0 -13
  214. data/spec/regression/expected/ubuntu.txt +0 -5
  215. data/spec/regression/expected/ufw.txt +0 -12
  216. data/spec/regression/expected/unicorn.txt +0 -7
  217. data/spec/regression/expected/users.txt +0 -12
  218. data/spec/regression/expected/vcruntime.txt +0 -8
  219. data/spec/regression/expected/vim.txt +0 -7
  220. data/spec/regression/expected/webpi.txt +0 -7
  221. data/spec/regression/expected/whitelist-node-attrs.txt +0 -7
  222. data/spec/regression/expected/windows.txt +0 -35
  223. data/spec/regression/expected/wix.txt +0 -5
  224. data/spec/regression/expected/xml.txt +0 -7
  225. data/spec/regression/expected/yum.txt +0 -15
  226. data/spec/regression/regression_spec.rb +0 -23
  227. data/spec/spec_helper.rb +0 -132
  228. data/spec/unit/api_spec.rb +0 -1939
  229. data/spec/unit/chef_spec.rb +0 -66
  230. data/spec/unit/command_line_spec.rb +0 -136
  231. data/spec/unit/domain_spec.rb +0 -78
  232. data/spec/unit/linter_spec.rb +0 -107
  233. data/spec/unit/template_spec.rb +0 -53
@@ -1,28 +0,0 @@
1
- Feature: Check for dodgy provider conditions
2
-
3
- In order to ensure that resources are declared as intended within a resource provider
4
- As a developer
5
- I want to identify resource conditions that will be checked only for the first resource
6
-
7
- Scenario: Provider with no condition
8
- Given a cookbook that contains a LWRP that declares a resource with no condition
9
- When I check the cookbook
10
- Then the dodgy resource condition warning 021 should not be displayed against the provider file
11
-
12
- Scenario Outline: Provider conditions
13
- Given a cookbook that contains a LWRP that declares a resource called <name> with the condition <condition>
14
- When I check the cookbook
15
- Then the dodgy resource condition warning 021 <show_warning> be displayed against the provider file
16
-
17
- Examples:
18
- | name | condition | show_warning |
19
- | "create_site" | not_if { ::File.exists?("/tmp/fixed-path")} | should not |
20
- | "create_site" | not_if { ::File.exists?("/tmp/#{new_resource.name}")} | should |
21
- | "create_site_#{new_resource.name}" | not_if { ::File.exists?("/tmp/#{new_resource.name}")} | should not |
22
- | "create_site" | only_if { ::File.exists?("/tmp/#{new_resource.name}")} | should |
23
- | "create_site_#{new_resource.name}" | only_if { ::File.exists?("/tmp/#{new_resource.name}")} | should not |
24
- | "create_site" | only_if "[ ! -f \"/tmp/#{new_resource.name}\" ]" | should |
25
- | "create_site" | not_if "[ -f \"/tmp/#{new_resource.name}\" ]" | should |
26
- | "create_site_#{new_resource.name}" | not_if "[ -f \"/tmp/#{new_resource.name}\" ]" | should not |
27
- | "create_site" | only_if do ::File.exists?("/tmp/#{new_resource.name}") end | should |
28
- | "create_site_#{new_resource.name}" | only_if do ::File.exists?("/tmp/#{new_resource.name}") end | should not |
@@ -1,43 +0,0 @@
1
- Feature: Check for dodgy resource conditions within a loop
2
-
3
- In order to ensure that resources are declared as intended
4
- As a developer
5
- I want to identify resource conditions within a loop that will not be re-evaluated
6
-
7
- Scenario: Resource outside a loop
8
- Given a cookbook recipe that declares a resource called "feed_pet" with the condition outside a loop
9
- When I check the cookbook
10
- Then the dodgy resource condition warning 022 should not be displayed
11
-
12
- Scenario Outline: Resource within a loop
13
- Given a cookbook recipe that declares a resource called <name> with the condition <condition> in a loop
14
- When I check the cookbook
15
- Then the dodgy resource condition warning 022 <show_warning> be displayed
16
-
17
- Examples:
18
- | name | condition | show_warning |
19
- | "feed_pet" | | should not |
20
- | "feed_pet" | not_if { ::File.exists?("/tmp/fixed-path")} | should not |
21
- | "feed_pet" | not_if { ::File.exists?("/tmp/#{pet_name}")} | should |
22
- | "feed_pet" | only_if { ::File.exists?("/tmp/#{pet_name}")} | should |
23
- | "feed_pet" | only_if { ::File.exists?(pet_name)} | should |
24
- | "feed_pet_#{pet_name}" | not_if { ::File.exists?("/tmp/#{pet_name}")} | should not |
25
- | "feed_pet" | not_if { ::File.exists?("/tmp/#{unrelated_var}")} | should not |
26
- | "feed_pet" | only_if "[ -f \"/tmp/#{pet_name}\" ]" | should |
27
- | "feed_pet_#{pet_name}" | not_if "[ -f \"/tmp/#{pet_name}\" ]" | should not |
28
- | pet_name | not_if "[ -f \"/tmp/#{pet_name}\" ]" | should not |
29
-
30
- Scenario: Resource within a multi-arg block
31
- Given a resource declared with a guard within a loop with multiple block arguments
32
- When I check the cookbook
33
- Then the dodgy resource condition warning 022 should not be shown
34
-
35
- Scenario: Resource guard contains a block
36
- Given a resource that declares a guard containing a block
37
- When I check the cookbook
38
- Then the dodgy resource condition warning 022 should not be shown
39
-
40
- Scenario: Loop in a definition
41
- Given a resource declared within a definition
42
- When I check the cookbook
43
- Then the dodgy resource condition warning 022 should not be shown
@@ -1,43 +0,0 @@
1
- Feature: Check for missing platforms
2
-
3
- In order to maximise the portability of my cookbooks
4
- As a developer
5
- I want to identify when a recipe misses a popular flavour from a platform family
6
-
7
- Scenario Outline: Platform flavour missing
8
- Given a cookbook recipe with a '<type>' condition for flavours <flavours>
9
- And the cookbook metadata declares support for <supports>
10
- When I check the cookbook
11
- Then the consider adding platform warning 024 <warning>
12
-
13
- Examples:
14
- | type | supports | flavours | warning |
15
- | case | | chalk,cheese | should not be shown |
16
- | case | | debian,ubuntu | should not be shown |
17
- | case | | centos,redhat,scientific,oracle | should not be shown |
18
- | case | | centos,debian,fedora,redhat,scientific,oracle | should not be shown |
19
- | case | | redhat | should not be shown |
20
- | case | | centos,redhat | should be shown |
21
- | case | centos,redhat | centos,redhat | should not be shown |
22
- | case | | centos,redhat,scientific | should be shown |
23
- | case | centos,redhat,scientific | centos,redhat,scientific | should not be shown |
24
- | case | centos,debian,scientific | centos,scientific | should not be shown |
25
- | case | centos,redhat,scientific | redhat,scientific | should be shown |
26
- | case | debian,redhat,centos,fedora | redhat,centos,fedora | should not be shown |
27
- | platform? | | centos,redhat,scientific,oracle | should not be shown |
28
- | platform? | | redhat | should not be shown |
29
- | platform? | | redhat,scientific | should be shown |
30
- | platform? | redhat,scientific | redhat,scientific | should not be shown |
31
- | platform? | centos,redhat,scientific | centos,scientific | should be shown |
32
- | platform? | centos,redhat,oracle | centos,redhat | should be shown |
33
-
34
- Scenario: Supported platforms specifies versions
35
- Given a cookbook recipe with a 'case' condition for flavours 'redhat,scientific'
36
- And the cookbook metadata declares support with versions specified
37
- When I check the cookbook
38
- Then the consider adding platform warning 024 should not be shown
39
-
40
- Scenario: Unrelated case statement
41
- Given a cookbook recipe with a case condition unrelated to platform
42
- When I check the cookbook
43
- Then the consider adding platform warning 024 should not be shown
@@ -1,22 +0,0 @@
1
- Feature: Check for use of internal attributes
2
-
3
- In order to avoid confusion about the expected state of a converged node
4
- As a developer
5
- I want to identify calls to 'internal' resource attributes
6
-
7
- Scenario Outline: Access of internal attributes
8
- Given a cookbook recipe that declares a <resource> resource with the <attribute> attribute set to <value>
9
- When I check the cookbook
10
- Then the resource sets internal attribute warning 027 should be <show_warning>
11
-
12
- Examples:
13
- | resource | attribute | value | show_warning |
14
- | service | enabled | true | shown |
15
- | service | enabled | false | shown |
16
- | service | enabled | [].include?('foo') | shown |
17
- | service | running | true | shown |
18
- | service | running | false | shown |
19
- | service | running | [].include?('foo') | shown |
20
- | service | service_name | "foo" | not shown |
21
- | my_lwrp | enabled | true | not shown |
22
- | my_lwrp | running | true | not shown |
@@ -1,25 +0,0 @@
1
- Feature: Check for debugger breakpoints
2
-
3
- In order to avoid halting a converge
4
- As a developer
5
- I want to identify debugger breakpoints that have not been removed
6
-
7
- Scenario Outline: Debugger breakpoints
8
- Given a cookbook with a <component> that <includes> a breakpoint
9
- When I check the cookbook
10
- Then the debugger breakpoint warning 030 should be <show_warning> against the <component>
11
-
12
- Examples:
13
- | component | includes | show_warning |
14
- | library | does not include | not shown |
15
- | library | includes | shown |
16
- | metadata | does not include | not shown |
17
- | metadata | includes | shown |
18
- | provider | does not include | not shown |
19
- | provider | includes | shown |
20
- | recipe | does not include | not shown |
21
- | recipe | includes | shown |
22
- | resource | does not include | not shown |
23
- | resource | includes | shown |
24
- | template | does not include | not shown |
25
- | template | includes | shown |
@@ -1,24 +0,0 @@
1
- Feature: Check for invalid notification timings
2
-
3
- In order to flag invalid notifications more quickly
4
- As a developer
5
- I want to identify notifications that have an invalid timing type
6
-
7
- Scenario Outline: Notification timings
8
- Given a cookbook recipe with a resource that <type> <notification_timing>
9
- When I check the cookbook specifying <version> as the Chef version
10
- Then the invalid notification timing warning 032 <display> be displayed
11
- Examples:
12
- | type | notification_timing | version | display |
13
- | notifies | | 12.6.0 | should not |
14
- | notifies | before | 12.6.0 | should not |
15
- | notifies | immediately | 12.6.0 | should not |
16
- | notifies | immediate | 12.6.0 | should not |
17
- | notifies | delayed | 12.6.0 | should not |
18
- | notifies | imediately | 12.6.0 | should |
19
- | subscribes | | 12.6.0 | should not |
20
- | subscribes | before | 12.6.0 | should not |
21
- | subscribes | immediately | 12.6.0 | should not |
22
- | subscribes | immediate | 12.6.0 | should not |
23
- | subscribes | delayed | 12.6.0 | should not |
24
- | subscribes | imediately | 12.6.0 | should |
@@ -1,39 +0,0 @@
1
- Feature: Check for missing template
2
-
3
- In order to ensure the Chef run is successful
4
- As a developer
5
- I want to identify template resources that refer to missing templates
6
-
7
- Scenario Outline: Template types
8
- Given a cookbook recipe that <template_type>
9
- When I check the cookbook
10
- Then the missing template warning 033 <warning>
11
- Examples:
12
- | template_type | warning |
13
- | defines a template where both the name and source are complex expressions | should not be displayed |
14
- | defines a template where name and source are both simple expressions | should not be displayed |
15
- | defines a template where name is a complex expression | should not be displayed |
16
- | infers a template with an expression | should not be displayed |
17
- | refers to a hidden template | should not be displayed |
18
- | refers to a local template | should not be displayed |
19
- | refers to a missing template | should be displayed |
20
- | refers to a template in a subdirectory | should not be displayed |
21
- | refers to a template | should not be displayed |
22
- | refers to a template with an expression | should not be displayed |
23
- | refers to a template without an erb extension | should not be displayed |
24
- | uses a missing inferred template | should be displayed |
25
- | uses an inferred template | should not be displayed |
26
- | uses a template from another cookbook | should not be displayed |
27
-
28
- Scenario Outline: Template in the root of the templates directory
29
- Given a cookbook recipe that refers to a template in the root of the templates directory
30
- When I check the cookbook specifying <version> as the Chef version
31
- Then the missing template warning 033 <warning>
32
- Examples:
33
- | version | warning |
34
- | 12.9.38 | should not be displayed |
35
-
36
- Scenario: Template within deploy resource
37
- Given a cookbook recipe with a deploy resource that contains a template resource
38
- When I check the cookbook
39
- Then the missing template warning 033 should not be displayed against the template
@@ -1,80 +0,0 @@
1
- Feature: Check for unused template variables
2
-
3
- In order to identify failure to parameterise template variables
4
- As a developer
5
- I want to identify variables passed to templates that are not used
6
-
7
- Scenario: All variables present in template
8
- Given a cookbook template that uses all variables passed
9
- When I check the cookbook
10
- Then the unused template variables warning 034 should not be displayed
11
-
12
- Scenario Outline: No variables passed
13
- Given a cookbook that passes no variables to a template
14
- And the template contains the expression <expression>
15
- When I check the cookbook
16
- Then the unused template variables warning 034 should not be displayed against the template
17
- Examples:
18
- | expression |
19
- | node[:configs][:config_var] |
20
- | @config_var |
21
-
22
- Scenario Outline: Variables passed
23
- Given a cookbook that passes variables <variables> to a template with extension <extension>
24
- And the template <extension> contains the expression <expression>
25
- When I check the cookbook
26
- Then the unused template variables warning 034 <displayed> be displayed against the template <extension>
27
- Examples:
28
- | variables | expression | extension | displayed |
29
- | config_var | node[:configs][:config_var] | .conf.erb | should |
30
- | config_var | @config_var | .conf.erb | should not |
31
- | config_var | @config_var['foo'] | .conf.erb | should not |
32
- | config_var | node[:configs][:config_var] | .conf.erb | should |
33
- | config_var,another_var | node[:configs][:config_var] | .conf.erb | should |
34
- | config_var,another_var | @config_var | .conf.erb | should |
35
- | config_var,another_var | @another_var | .conf.erb | should |
36
- | config_var | @config_var | .conf | should not |
37
- | config_var,another_var | @another_var | .conf | should |
38
-
39
- Scenario Outline: Variables passed with includes
40
- Given a cookbook that passes variables <variables> to a template with extension <extension>
41
- And the template <extension> contains partial includes of type <type> with the expression <expression>
42
- When I check the cookbook
43
- Then the unused template variables warning 034 <displayed> be displayed against the template <extension>
44
- Examples:
45
- | variables | expression | type | extension | displayed |
46
- | config_var | node[:configs][:config_var] | no parentheses | .conf.erb | should |
47
- | config_var | @config_var | no parentheses | .conf.erb | should not |
48
- | config_var | @config_var['foo'] | no parentheses | .conf.erb | should not |
49
- | config_var | node[:configs][:config_var] | no parentheses | .conf.erb | should |
50
- | config_var,another_var | node[:configs][:config_var] | no parentheses | .conf.erb | should |
51
- | config_var,another_var | @config_var | no parentheses | .conf.erb | should |
52
- | config_var,another_var | @another_var | no parentheses | .conf.erb | should |
53
- | config_var | @config_var | no parentheses | .conf | should not |
54
- | config_var,another_var | @another_var | no parentheses | .conf | should |
55
- | config_var | node[:configs][:config_var] | parentheses | .conf.erb | should |
56
- | config_var | @config_var | parentheses | .conf.erb | should not |
57
- | config_var | @config_var['foo'] | parentheses | .conf.erb | should not |
58
- | config_var | node[:configs][:config_var] | parentheses | .conf.erb | should |
59
- | config_var,another_var | node[:configs][:config_var] | parentheses | .conf.erb | should |
60
- | config_var,another_var | @config_var | parentheses | .conf.erb | should |
61
- | config_var,another_var | @another_var | parentheses | .conf.erb | should |
62
- | config_var | @config_var | parentheses | .conf | should not |
63
- | config_var,another_var | @another_var | parentheses | .conf | should |
64
- | config_var,another_var | @config_var,@another_var | nested | .conf | should not |
65
- | config_var,another_var | @config_var | nested | .conf | should |
66
-
67
- Scenario Outline: Template path is inferred
68
- Given a cookbook that passes variables <variables> to an inferred template
69
- And the inferred template contains the expression <expression>
70
- When I check the cookbook
71
- Then the unused template variables warning 034 <displayed> be displayed against the inferred template
72
- Examples:
73
- | variables | expression | displayed |
74
- | config_var | node[:configs][:config_var] | should |
75
- | config_var | @config_var | should not |
76
-
77
- Scenario: Template includes contain cycle
78
- Given a template that includes a partial that includes the original template again
79
- When I check the cookbook
80
- Then the unused template variables warning 034 should not be displayed
@@ -1,34 +0,0 @@
1
- Feature: Check for invalid notification actions
2
-
3
- In order to flag invalid notifications more quickly
4
- As a developer
5
- I want to identify notifications that have an action which is invalid for the notified resource
6
-
7
- Scenario Outline: Notification actions
8
- Given a cookbook recipe with a resource that notifies a <resource> to <action>
9
- When I check the cookbook
10
- Then the invalid notification action warning 037 <display> be displayed
11
- Examples:
12
- | resource | action | display |
13
- | service | restart | should not |
14
- | service | nothing | should not |
15
- | service | create | should |
16
- | execute | run | should not |
17
- | execute | execute | should |
18
-
19
- Scenario Outline: Subscription actions
20
- Given a cookbook recipe with a <source> resource that subscribes to <action> when notified by a remote_file
21
- When I check the cookbook
22
- Then the invalid notification action warning 037 <display> be displayed
23
- Examples:
24
- | source | action | display |
25
- | service | restart | should not |
26
- | service | nothing | should not |
27
- | service | create | should |
28
- | execute | run | should not |
29
- | execute | execute | should |
30
-
31
- Scenario: Notification action is an expression
32
- Given a cookbook recipe with a resource that notifies where the action is an expression
33
- When I check the cookbook
34
- Then the invalid notification action warning 037 should not be displayed
@@ -1,39 +0,0 @@
1
- Feature: Check for invalid resource actions
2
-
3
- In order to avoid failure at converge time
4
- As a developer
5
- I want to identify resources that have an invalid action
6
-
7
- Scenario: Resource with default action
8
- Given a cookbook recipe with a service resource that does not specify an action
9
- When I check the cookbook
10
- Then the invalid resource action warning 038 should not be displayed
11
-
12
- Scenario: Resource with variable action
13
- Given a cookbook recipe with a service resource with an action specified via a variable
14
- When I check the cookbook
15
- Then the invalid resource action warning 038 should not be displayed
16
-
17
- Scenario Outline: Resource actions
18
- Given a cookbook recipe with a <resource> resource with action <action>
19
- When I check the cookbook
20
- Then the invalid resource action warning 038 <display> be displayed
21
- Examples:
22
- | resource | action | display |
23
- | service | restart | should not |
24
- | service | nothing | should not |
25
- | service | none | should |
26
- | service | create | should |
27
- | execute | run | should not |
28
- | execute | go | should |
29
- | foo | none | should not |
30
-
31
- Scenario Outline: Multiple actions
32
- Given a cookbook recipe with a <resource> resource with actions <actions>
33
- When I check the cookbook
34
- Then the invalid resource action warning 038 <display> be displayed
35
- Examples:
36
- | resource | actions | display |
37
- | service | enable, start | should not |
38
- | service | enble, start | should |
39
- | foo | energize, revitalize | should not |
@@ -1,33 +0,0 @@
1
- Feature: Check for key access to node methods
2
-
3
- In order to avoid failure at converge time
4
- As a developer
5
- I want to identify attempts to access node methods as attributes
6
-
7
- Scenario Outline: Resource actions
8
- Given a cookbook recipe that refers to <node_access>
9
- When I check the cookbook
10
- Then the node method cannot be accessed with key warning 039 <display> be displayed
11
- Examples:
12
- | node_access | display |
13
- | node['foo'] | should not |
14
- | node[:foo] | should not |
15
- | node.foo | should not |
16
- | node.chef_environment | should not |
17
- | node[:chef_environment] | should |
18
- | node['chef_environment'] | should |
19
- | node.run_state['foo'] | should not |
20
- | node.run_state[:foo] | should not |
21
- | node.run_state.foo | should not |
22
- | node['run_state']['foo'] | should |
23
- | node[:run_state][:foo] | should |
24
- | node['foo']['run_state'] | should not |
25
- | node[:foo][:run_state] | should not |
26
- | node['tags'] | should not |
27
- | node[:tags] | should not |
28
- | node.tags | should not |
29
-
30
- Scenario: Expressions that look like node access
31
- Given a cookbook recipe that has a confusingly named local variable "default"
32
- When I check the cookbook
33
- Then the node method cannot be accessed with key warning 039 should not be displayed
@@ -1,53 +0,0 @@
1
- Feature: Check for bare attribute keys
2
-
3
- In order to ensure my cookbook attributes are easily understood
4
- As a developer
5
- I want to avoid referring to bare attributes
6
-
7
- Scenario Outline: Cookbook attributes
8
- Given a cookbook attributes file that refers to an attribute with <reference>
9
- When I check the cookbook
10
- Then the bare attribute keys warning 044 <show_warning> be displayed against the attributes file
11
- Examples:
12
- | reference | show_warning |
13
- | node['hostname'] | should not |
14
- | node[:hostname] | should not |
15
- | node.hostname | should not |
16
- | hostname | should |
17
- | true | should not |
18
- | false | should not |
19
- | nil | should not |
20
-
21
- Scenario: Cookbook recipe
22
- Given a cookbook recipe that refers to an attribute with a bare keyword
23
- When I check the cookbook
24
- Then the bare attribute keys warning 044 should not be displayed
25
-
26
- Scenario: Variable declared in attributes file
27
- Given a cookbook attributes file that declares and refers to a local variable
28
- When I check the cookbook
29
- Then the bare attribute keys warning 044 should not be displayed against the local variable
30
-
31
- Scenario Outline: Block variable
32
- Given a cookbook attributes file with a <block_type> block that takes arguments
33
- When I check the cookbook
34
- Then the bare attribute keys warning 044 should not be displayed against the <block_type> block
35
- Examples:
36
- | block_type |
37
- | do |
38
- | brace |
39
-
40
- Scenario: Attribute set to library method call
41
- Given a cookbook attributes file that sets an attribute to be the result of a library call
42
- When I check the cookbook
43
- Then the bare attribute keys warning 044 should not be displayed against the library call
44
-
45
- Scenario: Attribute chain with new line
46
- Given a cookbook attributes file that sets an attribute to have line break
47
- When I check the cookbook
48
- Then the bare attribute keys warning 044 should not be displayed against the local variable
49
-
50
- Scenario: Attribute chain with new line and parameterized name
51
- Given a cookbook attributes file that sets an attribute to have line break and arguments
52
- When I check the cookbook
53
- Then the bare attribute keys warning 044 should not be displayed against the new line