foodcritic 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/CHANGELOG.md +691 -0
  2. data/LICENSE +21 -0
  3. data/README.md +28 -0
  4. data/chef_dsl_metadata/chef_0.10.10.json +22 -0
  5. data/chef_dsl_metadata/chef_10.12.0.json +22 -0
  6. data/chef_dsl_metadata/chef_10.14.0.json +22 -0
  7. data/chef_dsl_metadata/chef_10.14.2.json +22 -0
  8. data/chef_dsl_metadata/chef_10.14.4.json +22 -0
  9. data/chef_dsl_metadata/chef_10.16.0.json +22 -0
  10. data/chef_dsl_metadata/chef_10.16.2.json +22 -0
  11. data/chef_dsl_metadata/chef_10.16.4.json +22 -0
  12. data/chef_dsl_metadata/chef_10.16.6.json +22 -0
  13. data/chef_dsl_metadata/chef_10.18.0.json +22 -0
  14. data/chef_dsl_metadata/chef_10.18.2.json +22 -0
  15. data/chef_dsl_metadata/chef_10.20.0.json +22 -0
  16. data/chef_dsl_metadata/chef_10.22.0.json +22 -0
  17. data/chef_dsl_metadata/chef_10.24.0.json +22 -0
  18. data/chef_dsl_metadata/chef_10.24.4.json +8460 -0
  19. data/chef_dsl_metadata/chef_10.26.0.json +8460 -0
  20. data/chef_dsl_metadata/chef_11.0.0.json +22 -0
  21. data/chef_dsl_metadata/chef_11.2.0.json +22 -0
  22. data/chef_dsl_metadata/chef_11.4.0.json +22 -0
  23. data/chef_dsl_metadata/chef_11.4.2.json +8794 -0
  24. data/chef_dsl_metadata/chef_11.4.4.json +8794 -0
  25. data/features/002_check_string_interpolation.feature +45 -0
  26. data/features/003_check_for_chef_server.feature +56 -0
  27. data/features/004_check_service_resource_used.feature +53 -0
  28. data/features/005_check_for_resource_repetition.feature +64 -0
  29. data/features/006_check_file_mode.feature +35 -0
  30. data/features/007_check_for_undeclared_recipe_dependencies.feature +71 -0
  31. data/features/008_check_for_boilerplate_metadata.feature +25 -0
  32. data/features/009_check_for_unrecognised_resource_attributes.feature +77 -0
  33. data/features/010_check_search_syntax.feature +20 -0
  34. data/features/011_check_for_markdown_readme.feature +20 -0
  35. data/features/012_check_for_deprecated_readme_format.feature +20 -0
  36. data/features/013_check_for_hardcoded_tmpdir.feature +25 -0
  37. data/features/014_check_for_long_ruby_blocks.feature +30 -0
  38. data/features/015_check_for_definitions.feature +21 -0
  39. data/features/016_check_for_no_lwrp_default_action.feature +20 -0
  40. data/features/017_check_for_no_lwrp_notifications.feature +25 -0
  41. data/features/018_check_for_old_lwrp_notification_syntax.feature +25 -0
  42. data/features/019_check_for_consistent_node_access.feature +107 -0
  43. data/features/021_check_for_dodgy_lwrp_conditions.feature +28 -0
  44. data/features/022_check_for_dodgy_conditions_within_loop.feature +28 -0
  45. data/features/023_check_for_condition_around_resource.feature +52 -0
  46. data/features/024_check_for_missing_platforms.feature +43 -0
  47. data/features/025_check_for_deprecated_gem_install.feature +30 -0
  48. data/features/026_check_for_conditional_block_string.feature +20 -0
  49. data/features/027_check_for_internal_attribute_use.feature +22 -0
  50. data/features/028_check_for_incorrect_platform_method.feature +20 -0
  51. data/features/029_check_for_no_leading_cookbook_name.feature +18 -0
  52. data/features/030_check_for_debugger_breakpoints.feature +25 -0
  53. data/features/031_check_for_metadata_existence.feature +15 -0
  54. data/features/032_check_for_invalid_notification_timing.feature +22 -0
  55. data/features/033_check_for_missing_template.feature +75 -0
  56. data/features/034_check_for_unused_template_variables.feature +37 -0
  57. data/features/037_check_for_invalid_notification_action.feature +34 -0
  58. data/features/038_check_for_invalid_action.feature +51 -0
  59. data/features/039_check_for_key_access_to_node_methods.feature +33 -0
  60. data/features/040_check_raw_git_usage.feature +37 -0
  61. data/features/041_check_raw_download.feature +26 -0
  62. data/features/042_check_for_deprecated_require_recipe.feature +15 -0
  63. data/features/043_check_for_old_notification_style.feature +35 -0
  64. data/features/044_check_for_bare_attribute_keys.feature +43 -0
  65. data/features/045_check_for_cookbook_name_in_metadata.feature +20 -0
  66. data/features/046_check_for_assign_unless_nil_attributes.feature +21 -0
  67. data/features/build_framework_support.feature +99 -0
  68. data/features/checking_all_types_of_file.feature +40 -0
  69. data/features/choose_rules_to_apply.feature +49 -0
  70. data/features/command_line_help.feature +43 -0
  71. data/features/continuous_integration_support.feature +35 -0
  72. data/features/ignore_via_line_comments.feature +51 -0
  73. data/features/include_custom_rules.feature +29 -0
  74. data/features/individual_file.feature +12 -0
  75. data/features/limit_rules_to_specific_versions.feature +65 -0
  76. data/features/multiple_paths.feature +11 -0
  77. data/features/show_lines_matched.feature +20 -0
  78. data/features/sort_warnings.feature +10 -0
  79. data/features/specify_search_grammar.feature +25 -0
  80. data/features/step_definitions/cookbook_steps.rb +1791 -0
  81. data/features/support/command_helpers.rb +312 -0
  82. data/features/support/cookbook_helpers.rb +495 -0
  83. data/features/support/env.rb +11 -0
  84. data/lib/foodcritic.rb +0 -1
  85. data/lib/foodcritic/api.rb +3 -2
  86. data/lib/foodcritic/command_line.rb +4 -0
  87. data/lib/foodcritic/linter.rb +29 -6
  88. data/lib/foodcritic/output.rb +74 -26
  89. data/lib/foodcritic/rules.rb +6 -5
  90. data/lib/foodcritic/version.rb +1 -1
  91. data/man/foodcritic.1 +58 -0
  92. data/man/foodcritic.1.ronn +57 -0
  93. data/spec/foodcritic/api_spec.rb +1615 -0
  94. data/spec/foodcritic/chef_spec.rb +66 -0
  95. data/spec/foodcritic/command_line_spec.rb +51 -0
  96. data/spec/foodcritic/domain_spec.rb +24 -0
  97. data/spec/foodcritic/linter_spec.rb +91 -0
  98. data/spec/foodcritic/template_spec.rb +49 -0
  99. data/spec/regression/cookbooks.txt +135 -0
  100. data/spec/regression/expected-output.txt +443 -0
  101. data/spec/regression/regression_spec.rb +17 -0
  102. data/spec/regression_helpers.rb +37 -0
  103. data/spec/spec_helper.rb +10 -0
  104. metadata +87 -24
@@ -0,0 +1,30 @@
1
+ Feature: Check for deprecated gem install
2
+
3
+ In order to be clear and concise in my Chef recipes
4
+ As a developer
5
+ I want to use chef_gem in preference to manual compile-time gem install
6
+
7
+ Scenario: Normal gem install
8
+ Given a cookbook recipe that installs a gem
9
+ When I check the cookbook specifying 0.10.10 as the Chef version
10
+ Then the prefer chef_gem to manual install warning 025 should not be displayed
11
+
12
+ Scenario: Compile-time gem install
13
+ Given a cookbook recipe that installs a gem at compile time using the deprecated syntax
14
+ When I check the cookbook specifying 0.10.10 as the Chef version
15
+ Then the prefer chef_gem to manual install warning 025 should be shown
16
+
17
+ Scenario: Compile-time gem upgrade
18
+ Given a cookbook recipe that upgrades a gem at compile time using the deprecated syntax
19
+ When I check the cookbook specifying 0.10.10 as the Chef version
20
+ Then the prefer chef_gem to manual install warning 025 should be shown
21
+
22
+ Scenario: Compile-time gem install - multiple from array
23
+ Given a cookbook recipe that installs multiple gems from an array at compile time using the deprecated syntax
24
+ When I check the cookbook specifying 0.10.10 as the Chef version
25
+ Then the prefer chef_gem to manual install warning 025 should be shown
26
+
27
+ Scenario: Compile-time gem install - multiple from wordlist
28
+ Given a cookbook recipe that installs multiple gems from a word list at compile time using the deprecated syntax
29
+ When I check the cookbook specifying 0.10.10 as the Chef version
30
+ Then the prefer chef_gem to manual install warning 025 should be shown
@@ -0,0 +1,20 @@
1
+ Feature: Check for conditional attribute blocks with only strings
2
+
3
+ In order to avoid wrongly actioning a resource
4
+ As a developer
5
+ I want to identify conditional attribute blocks that consist only of strings
6
+
7
+ Scenario Outline:
8
+ Given a cookbook recipe that declares a resource with a <conditional_attribute>
9
+ When I check the cookbook
10
+ Then the conditional block contains only string warning 026 should be <show_warning>
11
+
12
+ Examples:
13
+ | conditional_attribute | show_warning |
14
+ | not_if { "ls foo" } | shown |
15
+ | not_if do "ls foo" end | shown |
16
+ | only_if { "ls #{node['foo']['path']}" } | shown |
17
+ | not_if { "ls #{foo.method()}" } | shown |
18
+ | only_if { foo.bar } | not shown |
19
+ | not_if { foo.to_s } | not shown |
20
+ | not_if { File.exists?("/etc/foo") } | not shown |
@@ -0,0 +1,22 @@
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 |
@@ -0,0 +1,20 @@
1
+ Feature: Check for incorrect platform method usage
2
+
3
+ In order to avoid running code intended for another platform
4
+ As a developer
5
+ I want to identify conditionals that wrongly use node.platform?
6
+
7
+ Scenario Outline: Platform conditionals
8
+ Given a cookbook recipe that wraps a platform-specific resource in a <conditional> conditional
9
+ When I check the cookbook
10
+ Then the incorrect platform usage warning 028 should be <show_warning>
11
+
12
+ Examples:
13
+ | conditional | show_warning |
14
+ | platform? 'linux' | not shown |
15
+ | platform?('linux') | not shown |
16
+ | platform?('linux', 'mac_os_x') | not shown |
17
+ | node.platform? 'linux' | shown |
18
+ | node.platform?('linux') | shown |
19
+ | node.platform?('linux', 'mac_os_x') | shown |
20
+ | node.platform == 'linux' | not shown |
@@ -0,0 +1,18 @@
1
+ Feature: Check for no leading cookbook name
2
+
3
+ In order to ensure cookbook recipes are correctly listed
4
+ As a developer
5
+ I want to identify recipes defined in metadata that do not include the leading cookbook name
6
+
7
+ Scenario Outline: Recipe declaration in metadata
8
+ Given a cookbook with metadata that declares a recipe with <declaration>
9
+ When I check the cookbook
10
+ Then the no leading cookbook name warning 029 should be <show_warning>
11
+
12
+ Examples:
13
+ | declaration | show_warning |
14
+ | recipe "example", "Installs Example" | not shown |
15
+ | recipe "example::default", "Installs Example" | not shown |
16
+ | recipe "default", "Installs Example" | shown |
17
+ | recipe my_var, "Installs Example" | not shown |
18
+ | recipe "#{my_var}::default", "Installs Example" | not shown |
@@ -0,0 +1,25 @@
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 |
@@ -0,0 +1,15 @@
1
+ Feature: Check for metadata existence
2
+
3
+ In order to ensure that cookbook has the minimum
4
+ As a developer
5
+ I want to verify that the metadata file exist
6
+
7
+ Scenario: Cookbook without metadata file
8
+ Given a cookbook that does not have defined metadata
9
+ When I check the cookbook
10
+ Then the non existing metadata warning 031 should be displayed against the metadata file
11
+
12
+ Scenario: Cookbook with metadata file
13
+ Given a cookbook that has the default boilerplate metadata generated by knife
14
+ When I check the cookbook
15
+ Then the non existing metadata warning 031 should not be displayed against the metadata file
@@ -0,0 +1,22 @@
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
10
+ Then the invalid notification timing warning 032 <display> be displayed
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 |
@@ -0,0 +1,75 @@
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: Missing template
8
+ Given a cookbook recipe that refers to a missing template
9
+ When I check the cookbook
10
+ Then the missing template warning 033 should be displayed
11
+
12
+ Scenario: Missing template (inferred)
13
+ Given a cookbook recipe that uses a missing inferred template
14
+ When I check the cookbook
15
+ Then the missing template warning 033 should be displayed
16
+
17
+ Scenario: Present template
18
+ Given a cookbook recipe that refers to a template
19
+ When I check the cookbook
20
+ Then the missing template warning 033 should not be displayed
21
+
22
+ Scenario: Present template (not .erb)
23
+ Given a cookbook recipe that refers to a template without an erb extension
24
+ When I check the cookbook
25
+ Then the missing template warning 033 should not be displayed
26
+
27
+ Scenario: Present template (subdirectory)
28
+ Given a cookbook recipe that refers to a template in a subdirectory
29
+ When I check the cookbook
30
+ Then the missing template warning 033 should not be displayed
31
+
32
+ Scenario: Present template (inferred)
33
+ Given a cookbook recipe that uses an inferred template
34
+ When I check the cookbook
35
+ Then the missing template warning 033 should not be displayed
36
+
37
+ Scenario: Template present in another cookbook
38
+ Given a cookbook recipe that uses a template from another cookbook
39
+ When I check the cookbook
40
+ Then the missing template warning 033 should not be displayed
41
+
42
+ Scenario: Local template
43
+ Given a cookbook recipe that refers to a local template
44
+ When I check the cookbook
45
+ Then the missing template warning 033 should not be displayed
46
+
47
+ Scenario: Template source name is an expression
48
+ Given a cookbook recipe that refers to a template with an expression
49
+ When I check the cookbook
50
+ Then the missing template warning 033 should not be displayed
51
+
52
+ Scenario: Template source is an expression (inferred)
53
+ Given a cookbook recipe that infers a template with an expression
54
+ When I check the cookbook
55
+ Then the missing template warning 033 should not be displayed
56
+
57
+ Scenario: Template name and source are expressions
58
+ Given a cookbook recipe that defines a template where name and source are both simple expressions
59
+ When I check the cookbook
60
+ Then the missing template warning 033 should not be displayed
61
+
62
+ Scenario: Template name is a complex expression
63
+ Given a cookbook recipe that defines a template where name is a complex expression
64
+ When I check the cookbook
65
+ Then the missing template warning 033 should not be displayed
66
+
67
+ Scenario: Template name and source are complex expressions
68
+ Given a cookbook recipe that defines a template where both the name and source are complex expressions
69
+ When I check the cookbook
70
+ Then the missing template warning 033 should not be displayed
71
+
72
+ Scenario: Template within deploy resource
73
+ Given a cookbook recipe with a deploy resource that contains a template resource
74
+ When I check the cookbook
75
+ Then the missing template warning 033 should not be displayed against the template
@@ -0,0 +1,37 @@
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 |
@@ -0,0 +1,34 @@
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
@@ -0,0 +1,51 @@
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 |
40
+
41
+ Scenario Outline: Reconfigure a package
42
+ Given a recipe that reconfigures a package
43
+ When I check the cookbook specifying <version> as the Chef version
44
+ Then the invalid resource action warning 038 <display> be displayed
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 |
@@ -0,0 +1,33 @@
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
@@ -0,0 +1,37 @@
1
+ Feature: Check for direct usage of git
2
+
3
+ In order to access source control repositories idiomatically
4
+ As a developer
5
+ I want to use resources for repository access rather than executing git directly
6
+
7
+ Scenario Outline: Execute resource
8
+ Given a cookbook recipe with an execute resource named <name>
9
+ When I check the cookbook
10
+ Then the execute resource used to run git commands warning 040 <display> be displayed
11
+ Examples:
12
+ | name | display |
13
+ | git pull | should |
14
+ | git clone | should |
15
+ | git fetch | should |
16
+ | git checkout | should |
17
+ | git reset --hard | should |
18
+ | git show | should not |
19
+ | echo 'bob' && git show | should not |
20
+ | which foo | should not |
21
+
22
+ Scenario Outline: Execute resource
23
+ Given a cookbook recipe with an execute resource that runs the command <command>
24
+ When I check the cookbook
25
+ Then the execute resource used to run git commands warning 040 <display> be displayed
26
+ Examples:
27
+ | command | display |
28
+ | git clone https://github.com/git/git.git | should |
29
+ | git clone --depth 10 https://github.com/git/git.git | should |
30
+ | git pull | should |
31
+ | git fetch origin | should |
32
+ | git checkout master | should |
33
+ | git reset --hard | should |
34
+ | git show | should not |
35
+ | echo 'bob' && git show | should not |
36
+ | gitk | should not |
37
+ | curl http://github.com/ | should not |