foodcritic 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +691 -0
- data/LICENSE +21 -0
- data/README.md +28 -0
- data/chef_dsl_metadata/chef_0.10.10.json +22 -0
- data/chef_dsl_metadata/chef_10.12.0.json +22 -0
- data/chef_dsl_metadata/chef_10.14.0.json +22 -0
- data/chef_dsl_metadata/chef_10.14.2.json +22 -0
- data/chef_dsl_metadata/chef_10.14.4.json +22 -0
- data/chef_dsl_metadata/chef_10.16.0.json +22 -0
- data/chef_dsl_metadata/chef_10.16.2.json +22 -0
- data/chef_dsl_metadata/chef_10.16.4.json +22 -0
- data/chef_dsl_metadata/chef_10.16.6.json +22 -0
- data/chef_dsl_metadata/chef_10.18.0.json +22 -0
- data/chef_dsl_metadata/chef_10.18.2.json +22 -0
- data/chef_dsl_metadata/chef_10.20.0.json +22 -0
- data/chef_dsl_metadata/chef_10.22.0.json +22 -0
- data/chef_dsl_metadata/chef_10.24.0.json +22 -0
- data/chef_dsl_metadata/chef_10.24.4.json +8460 -0
- data/chef_dsl_metadata/chef_10.26.0.json +8460 -0
- data/chef_dsl_metadata/chef_11.0.0.json +22 -0
- data/chef_dsl_metadata/chef_11.2.0.json +22 -0
- data/chef_dsl_metadata/chef_11.4.0.json +22 -0
- data/chef_dsl_metadata/chef_11.4.2.json +8794 -0
- data/chef_dsl_metadata/chef_11.4.4.json +8794 -0
- data/features/002_check_string_interpolation.feature +45 -0
- data/features/003_check_for_chef_server.feature +56 -0
- data/features/004_check_service_resource_used.feature +53 -0
- data/features/005_check_for_resource_repetition.feature +64 -0
- data/features/006_check_file_mode.feature +35 -0
- data/features/007_check_for_undeclared_recipe_dependencies.feature +71 -0
- data/features/008_check_for_boilerplate_metadata.feature +25 -0
- data/features/009_check_for_unrecognised_resource_attributes.feature +77 -0
- data/features/010_check_search_syntax.feature +20 -0
- data/features/011_check_for_markdown_readme.feature +20 -0
- data/features/012_check_for_deprecated_readme_format.feature +20 -0
- data/features/013_check_for_hardcoded_tmpdir.feature +25 -0
- data/features/014_check_for_long_ruby_blocks.feature +30 -0
- data/features/015_check_for_definitions.feature +21 -0
- data/features/016_check_for_no_lwrp_default_action.feature +20 -0
- data/features/017_check_for_no_lwrp_notifications.feature +25 -0
- data/features/018_check_for_old_lwrp_notification_syntax.feature +25 -0
- data/features/019_check_for_consistent_node_access.feature +107 -0
- data/features/021_check_for_dodgy_lwrp_conditions.feature +28 -0
- data/features/022_check_for_dodgy_conditions_within_loop.feature +28 -0
- data/features/023_check_for_condition_around_resource.feature +52 -0
- data/features/024_check_for_missing_platforms.feature +43 -0
- data/features/025_check_for_deprecated_gem_install.feature +30 -0
- data/features/026_check_for_conditional_block_string.feature +20 -0
- data/features/027_check_for_internal_attribute_use.feature +22 -0
- data/features/028_check_for_incorrect_platform_method.feature +20 -0
- data/features/029_check_for_no_leading_cookbook_name.feature +18 -0
- data/features/030_check_for_debugger_breakpoints.feature +25 -0
- data/features/031_check_for_metadata_existence.feature +15 -0
- data/features/032_check_for_invalid_notification_timing.feature +22 -0
- data/features/033_check_for_missing_template.feature +75 -0
- data/features/034_check_for_unused_template_variables.feature +37 -0
- data/features/037_check_for_invalid_notification_action.feature +34 -0
- data/features/038_check_for_invalid_action.feature +51 -0
- data/features/039_check_for_key_access_to_node_methods.feature +33 -0
- data/features/040_check_raw_git_usage.feature +37 -0
- data/features/041_check_raw_download.feature +26 -0
- data/features/042_check_for_deprecated_require_recipe.feature +15 -0
- data/features/043_check_for_old_notification_style.feature +35 -0
- data/features/044_check_for_bare_attribute_keys.feature +43 -0
- data/features/045_check_for_cookbook_name_in_metadata.feature +20 -0
- data/features/046_check_for_assign_unless_nil_attributes.feature +21 -0
- data/features/build_framework_support.feature +99 -0
- data/features/checking_all_types_of_file.feature +40 -0
- data/features/choose_rules_to_apply.feature +49 -0
- data/features/command_line_help.feature +43 -0
- data/features/continuous_integration_support.feature +35 -0
- data/features/ignore_via_line_comments.feature +51 -0
- data/features/include_custom_rules.feature +29 -0
- data/features/individual_file.feature +12 -0
- data/features/limit_rules_to_specific_versions.feature +65 -0
- data/features/multiple_paths.feature +11 -0
- data/features/show_lines_matched.feature +20 -0
- data/features/sort_warnings.feature +10 -0
- data/features/specify_search_grammar.feature +25 -0
- data/features/step_definitions/cookbook_steps.rb +1791 -0
- data/features/support/command_helpers.rb +312 -0
- data/features/support/cookbook_helpers.rb +495 -0
- data/features/support/env.rb +11 -0
- data/lib/foodcritic.rb +0 -1
- data/lib/foodcritic/api.rb +3 -2
- data/lib/foodcritic/command_line.rb +4 -0
- data/lib/foodcritic/linter.rb +29 -6
- data/lib/foodcritic/output.rb +74 -26
- data/lib/foodcritic/rules.rb +6 -5
- data/lib/foodcritic/version.rb +1 -1
- data/man/foodcritic.1 +58 -0
- data/man/foodcritic.1.ronn +57 -0
- data/spec/foodcritic/api_spec.rb +1615 -0
- data/spec/foodcritic/chef_spec.rb +66 -0
- data/spec/foodcritic/command_line_spec.rb +51 -0
- data/spec/foodcritic/domain_spec.rb +24 -0
- data/spec/foodcritic/linter_spec.rb +91 -0
- data/spec/foodcritic/template_spec.rb +49 -0
- data/spec/regression/cookbooks.txt +135 -0
- data/spec/regression/expected-output.txt +443 -0
- data/spec/regression/regression_spec.rb +17 -0
- data/spec/regression_helpers.rb +37 -0
- data/spec/spec_helper.rb +10 -0
- metadata +87 -24
@@ -0,0 +1,45 @@
|
|
1
|
+
Feature: Check String Interpolation
|
2
|
+
|
3
|
+
In order to make my cookbooks more readable
|
4
|
+
As a developer
|
5
|
+
I want to identify if values are unnecessarily interpolated
|
6
|
+
|
7
|
+
Scenario: Resource name interpolated string (symbol)
|
8
|
+
Given a cookbook with a single recipe that creates a directory resource with an interpolated name
|
9
|
+
When I check the cookbook
|
10
|
+
Then the string interpolation warning 002 should be displayed
|
11
|
+
|
12
|
+
Scenario: Resource name interpolated string
|
13
|
+
Given a cookbook with a single recipe that creates a directory resource with an interpolated name from a string
|
14
|
+
When I check the cookbook
|
15
|
+
Then the string interpolation warning 002 should be displayed
|
16
|
+
|
17
|
+
Scenario: Resource name string literal
|
18
|
+
Given a cookbook with a single recipe that creates a directory resource with a string literal
|
19
|
+
When I check the cookbook
|
20
|
+
Then the string interpolation warning 002 should not be displayed
|
21
|
+
|
22
|
+
Scenario: Resource name compound expression
|
23
|
+
Given a cookbook with a single recipe that creates a directory resource with a compound expression
|
24
|
+
When I check the cookbook
|
25
|
+
Then the string interpolation warning 002 should not be displayed
|
26
|
+
|
27
|
+
Scenario: Resource name literal and interpolated
|
28
|
+
Given a cookbook with a single recipe that creates a directory resource with a literal and interpolated variable
|
29
|
+
When I check the cookbook
|
30
|
+
Then the string interpolation warning 002 should not be displayed
|
31
|
+
|
32
|
+
Scenario: Resource name interpolated and literal
|
33
|
+
Given a cookbook with a single recipe that creates a directory resource with an interpolated variable and a literal
|
34
|
+
When I check the cookbook
|
35
|
+
Then the string interpolation warning 002 should not be displayed
|
36
|
+
|
37
|
+
Scenario: String interpolation in first Hash key
|
38
|
+
Given a cookbook with a single recipe for which the first hash key is an interpolated string
|
39
|
+
When I check the cookbook
|
40
|
+
Then the string interpolation warning 002 should be displayed
|
41
|
+
|
42
|
+
Scenario: String interpolation in first Hash value
|
43
|
+
Given a cookbook with a single recipe for which the first hash value is an interpolated string
|
44
|
+
When I check the cookbook
|
45
|
+
Then the string interpolation warning 002 should be displayed
|
@@ -0,0 +1,56 @@
|
|
1
|
+
Feature: Check for Chef Server
|
2
|
+
|
3
|
+
In order to ensure my cookbooks can be run with chef solo
|
4
|
+
As a developer
|
5
|
+
I want to identify if server-only features are used without checking to see if this is server
|
6
|
+
|
7
|
+
Scenario: Search without checking for server
|
8
|
+
Given a cookbook with a single recipe that searches without checking if this is server
|
9
|
+
When I check the cookbook
|
10
|
+
Then the check for server warning 003 should be displayed
|
11
|
+
|
12
|
+
Scenario: Search with older chef-solo-search
|
13
|
+
Given a cookbook with a single recipe that searches without checking if this is server
|
14
|
+
And another cookbook that has an older chef-solo-search installed
|
15
|
+
When I check the cookbook
|
16
|
+
Then the check for server warning 003 should not be displayed
|
17
|
+
|
18
|
+
Scenario: Search with chef-solo-search
|
19
|
+
Given a cookbook with a single recipe that searches without checking if this is server
|
20
|
+
And another cookbook that has chef-solo-search installed
|
21
|
+
When I check the cookbook
|
22
|
+
Then the check for server warning 003 should not be displayed
|
23
|
+
|
24
|
+
Scenario: Search checking for server
|
25
|
+
Given a cookbook with a single recipe that searches but checks first to see if this is server
|
26
|
+
When I check the cookbook
|
27
|
+
Then the check for server warning 003 should not be displayed given we have checked
|
28
|
+
|
29
|
+
Scenario: Search checking for server (unless)
|
30
|
+
Given a cookbook with a single recipe that searches but checks with a negative first to see if this is server
|
31
|
+
When I check the cookbook
|
32
|
+
Then the check for server warning 003 should not be displayed given we have checked
|
33
|
+
|
34
|
+
Scenario: Search checking for server (string access)
|
35
|
+
Given a cookbook with a single recipe that searches but checks first (string) to see if this is server
|
36
|
+
When I check the cookbook
|
37
|
+
Then the check for server warning 003 should not be displayed given we have checked
|
38
|
+
|
39
|
+
Scenario: Search checking for server (method access)
|
40
|
+
Given a cookbook with a single recipe that searches but checks first (method) to see if this is server
|
41
|
+
When I check the cookbook
|
42
|
+
Then the check for server warning 003 should not be displayed given we have checked
|
43
|
+
|
44
|
+
Scenario: Search checking for server (alternation)
|
45
|
+
Given a cookbook with a single recipe that searches but checks first (alternation) to see if this is server
|
46
|
+
When I check the cookbook
|
47
|
+
Then the check for server warning 003 should not be displayed against the condition
|
48
|
+
|
49
|
+
Scenario Outline: Search checking for server (return)
|
50
|
+
Given a cookbook with a single recipe that searches but returns first (<format>) if search is not supported
|
51
|
+
When I check the cookbook
|
52
|
+
Then the check for server warning 003 should not be displayed against the search after the <format> conditional
|
53
|
+
Examples:
|
54
|
+
| format |
|
55
|
+
| oneline |
|
56
|
+
| multiline |
|
@@ -0,0 +1,53 @@
|
|
1
|
+
Feature: Check for service commands within execute resources
|
2
|
+
|
3
|
+
In order to control services in an idiomatic way
|
4
|
+
As a developer
|
5
|
+
I want to identify if service commands are called by execute resources rather than using the service resource
|
6
|
+
|
7
|
+
Scenario: Execute resource starting a service via init.d
|
8
|
+
Given a cookbook recipe that uses execute to start a service via init.d
|
9
|
+
When I check the cookbook
|
10
|
+
Then the service resource warning 004 should be displayed
|
11
|
+
|
12
|
+
Scenario Outline: Execute resource controlling a service via the service command
|
13
|
+
Given a cookbook recipe that uses execute to <action> a service via the service command
|
14
|
+
When I check the cookbook
|
15
|
+
Then the service resource warning 004 <warning>
|
16
|
+
|
17
|
+
Examples:
|
18
|
+
| action | warning |
|
19
|
+
| start | should be displayed |
|
20
|
+
| stop | should be displayed |
|
21
|
+
| restart | should be displayed |
|
22
|
+
| reload | should be displayed |
|
23
|
+
| initdb | should not be displayed |
|
24
|
+
|
25
|
+
Scenario: Execute resource starting a service via upstart
|
26
|
+
Given a cookbook recipe that uses execute to start a service via upstart
|
27
|
+
When I check the cookbook
|
28
|
+
Then the service resource warning 004 should be displayed
|
29
|
+
|
30
|
+
Scenario: Execute resource starting a service via invoke-rc.d
|
31
|
+
Given a cookbook recipe that uses execute to start a service via invoke-rc.d
|
32
|
+
When I check the cookbook
|
33
|
+
Then the service resource warning 004 should be displayed
|
34
|
+
|
35
|
+
Scenario: Execute resource starting a service via the full path to the service command
|
36
|
+
Given a cookbook recipe that uses execute to start a service via the full path to the service command
|
37
|
+
When I check the cookbook
|
38
|
+
Then the service resource warning 004 should be displayed
|
39
|
+
|
40
|
+
Scenario: Execute resource starting a service via init.d (multiple commands)
|
41
|
+
Given a cookbook recipe that uses execute to sleep and then start a service via init.d
|
42
|
+
When I check the cookbook
|
43
|
+
Then the service resource warning 004 should be displayed
|
44
|
+
|
45
|
+
Scenario: Execute resource not controlling a service
|
46
|
+
Given a cookbook recipe that uses execute to list a directory
|
47
|
+
When I check the cookbook
|
48
|
+
Then the service resource warning 004 should not be displayed
|
49
|
+
|
50
|
+
Scenario: Execute resource using name attribute
|
51
|
+
Given a cookbook recipe that uses execute with a name attribute to start a service
|
52
|
+
When I check the cookbook
|
53
|
+
Then the service resource warning 004 should be displayed
|
@@ -0,0 +1,64 @@
|
|
1
|
+
Feature: Check for resource repetition
|
2
|
+
|
3
|
+
In order to write my recipe without being needlessly verbose
|
4
|
+
As a developer
|
5
|
+
I want to identify resources that vary minimally so I can reduce copy and paste
|
6
|
+
|
7
|
+
Scenario: Package resource varying only a single attribute
|
8
|
+
Given a cookbook recipe that declares multiple resources varying only in the package name
|
9
|
+
When I check the cookbook
|
10
|
+
Then the service resource warning 005 should be displayed
|
11
|
+
|
12
|
+
Scenario: Package resource varying only a single attribute for a small number of resources
|
13
|
+
Given a cookbook recipe that declares two or fewer resources varying only in the package name
|
14
|
+
When I check the cookbook
|
15
|
+
Then the service resource warning 005 should not be displayed
|
16
|
+
|
17
|
+
Scenario: Package resource varying multiple attributes
|
18
|
+
Given a cookbook recipe that declares multiple resources with more variation
|
19
|
+
When I check the cookbook
|
20
|
+
Then the service resource warning 005 should not be displayed
|
21
|
+
|
22
|
+
Scenario: Non-varying packages mixed with other resources
|
23
|
+
Given a cookbook recipe that declares multiple package resources mixed with other resources
|
24
|
+
When I check the cookbook
|
25
|
+
Then the service resource warning 005 should be displayed
|
26
|
+
|
27
|
+
Scenario: Non-contiguous packages mixed with other resources
|
28
|
+
Given a cookbook recipe that declares non contiguous package resources mixed with other resources
|
29
|
+
When I check the cookbook
|
30
|
+
Then the service resource warning 005 should not be displayed
|
31
|
+
|
32
|
+
Scenario: Execute resources branching
|
33
|
+
Given a cookbook recipe that declares execute resources varying only in the command in branching conditionals
|
34
|
+
When I check the cookbook
|
35
|
+
Then the service resource warning 005 should not be visible
|
36
|
+
|
37
|
+
Scenario: Execute resources branching - too many
|
38
|
+
Given a cookbook recipe that declares too many execute resources varying only in the command in branching conditionals
|
39
|
+
When I check the cookbook
|
40
|
+
Then the service resource warning 005 should be visible
|
41
|
+
|
42
|
+
Scenario: Execute resources branching in provider actions
|
43
|
+
Given a cookbook provider that declares execute resources varying only in the command in separate actions
|
44
|
+
When I check the cookbook
|
45
|
+
Then the service resource warning 005 should not be shown
|
46
|
+
|
47
|
+
Scenario: Execute resources in the same provider action
|
48
|
+
Given a cookbook provider that declares execute resources varying only in the command in the same action
|
49
|
+
When I check the cookbook
|
50
|
+
Then the service resource warning 005 should be shown
|
51
|
+
|
52
|
+
Scenario Outline: Template resources within a block
|
53
|
+
Given a cookbook recipe that declares multiple <type> template resources within a block
|
54
|
+
When I check the cookbook
|
55
|
+
Then the service resource warning 005 should <show> against the first resource in the block
|
56
|
+
Examples:
|
57
|
+
| type | show |
|
58
|
+
| varying | not be displayed |
|
59
|
+
| non-varying | be displayed |
|
60
|
+
|
61
|
+
Scenario: Directories with different file modes
|
62
|
+
Given a cookbook recipe that declares multiple directories with different file modes
|
63
|
+
When I check the cookbook
|
64
|
+
Then the service resource warning 005 should not be displayed
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Feature: Check file mode
|
2
|
+
|
3
|
+
In order to ensure that file and directory permissions are applied correctly
|
4
|
+
As a developer
|
5
|
+
I want to identify where the mode may not be interpreted as expected
|
6
|
+
|
7
|
+
Scenario Outline: Specifying file mode
|
8
|
+
Given a <resource> resource declared with the mode <mode>
|
9
|
+
When I check the cookbook
|
10
|
+
Then the warning 006 should be <shown_where_invalid>
|
11
|
+
|
12
|
+
Examples:
|
13
|
+
| resource | mode | shown_where_invalid |
|
14
|
+
| cookbook_file | "644" | valid |
|
15
|
+
| cookbook_file | 644 | invalid |
|
16
|
+
| cookbook_file | 00644 | valid |
|
17
|
+
| directory | 755 | invalid |
|
18
|
+
| directory | "755" | valid |
|
19
|
+
| directory | 0644 | valid |
|
20
|
+
| directory | "0644" | valid |
|
21
|
+
| directory | 400 | invalid |
|
22
|
+
| directory | 00400 | valid |
|
23
|
+
| file | "755" | valid |
|
24
|
+
| file | 755 | invalid |
|
25
|
+
| file | 644 | invalid |
|
26
|
+
| file | 044 | invalid |
|
27
|
+
| file | "0644" | valid |
|
28
|
+
| template | 00400 | valid |
|
29
|
+
| template | 400 | invalid |
|
30
|
+
| template | "400" | valid |
|
31
|
+
|
32
|
+
Scenario: Unspecified mode
|
33
|
+
Given a file resource declared without a mode
|
34
|
+
When I check the cookbook
|
35
|
+
Then the warning 006 should not be displayed
|
@@ -0,0 +1,71 @@
|
|
1
|
+
Feature: Check for undeclared recipe dependencies
|
2
|
+
|
3
|
+
In order to prevent failure of my Chef run due to a missing cookbook
|
4
|
+
As a developer
|
5
|
+
I want to identify included recipes that are not expressed in cookbook metadata
|
6
|
+
|
7
|
+
Scenario: Cookbook includes undeclared recipe dependency
|
8
|
+
Given a cookbook recipe that includes an undeclared recipe dependency
|
9
|
+
When I check the cookbook
|
10
|
+
Then the undeclared dependency warning 007 should be displayed
|
11
|
+
|
12
|
+
Scenario: Cookbook includes undeclared recipe dependency unscoped
|
13
|
+
Given a cookbook recipe that includes an undeclared recipe dependency unscoped
|
14
|
+
When I check the cookbook
|
15
|
+
Then the undeclared dependency warning 007 should be displayed
|
16
|
+
|
17
|
+
Scenario: Cookbook includes recipe via expression
|
18
|
+
Given a cookbook recipe that includes a recipe name from an expression
|
19
|
+
When I check the cookbook
|
20
|
+
Then the undeclared dependency warning 007 should not be displayed
|
21
|
+
|
22
|
+
Scenario Outline: Cookbook includes recipe via expression (embedded)
|
23
|
+
Given a cookbook recipe that includes a recipe name from an embedded expression <recipe_expression>
|
24
|
+
When I check the cookbook
|
25
|
+
Then the undeclared dependency warning 007 should not be displayed
|
26
|
+
Examples:
|
27
|
+
| recipe_expression |
|
28
|
+
| foo::#{node['foo']['fighter']} |
|
29
|
+
| #{cookbook_name}::other |
|
30
|
+
| #{cbk}_other::other |
|
31
|
+
|
32
|
+
Scenario: Cookbook includes declared recipe dependency
|
33
|
+
Given a cookbook recipe that includes a declared recipe dependency
|
34
|
+
When I check the cookbook
|
35
|
+
Then the undeclared dependency warning 007 should not be displayed
|
36
|
+
|
37
|
+
Scenario: Cookbook includes declared recipe dependency unscoped
|
38
|
+
Given a cookbook recipe that includes a declared recipe dependency unscoped
|
39
|
+
When I check the cookbook
|
40
|
+
Then the undeclared dependency warning 007 should not be displayed
|
41
|
+
|
42
|
+
Scenario: Cookbook includes several declared recipe dependencies
|
43
|
+
Given a cookbook recipe that includes several declared recipe dependencies - brace
|
44
|
+
When I check the cookbook
|
45
|
+
Then the undeclared dependency warning 007 should not be displayed
|
46
|
+
|
47
|
+
Scenario: Cookbook includes several declared recipe dependencies
|
48
|
+
Given a cookbook recipe that includes several declared recipe dependencies - block
|
49
|
+
When I check the cookbook
|
50
|
+
Then the undeclared dependency warning 007 should not be displayed
|
51
|
+
|
52
|
+
Scenario: Cookbook includes mix of declared and undeclared recipe dependencies
|
53
|
+
Given a cookbook recipe that includes both declared and undeclared recipe dependencies
|
54
|
+
When I check the cookbook
|
55
|
+
Then the undeclared dependency warning 007 should be displayed only for the undeclared dependencies
|
56
|
+
|
57
|
+
Scenario: Cookbook includes local recipe
|
58
|
+
Given a cookbook recipe that includes a local recipe
|
59
|
+
When I check the cookbook
|
60
|
+
Then the undeclared dependency warning 007 should not be displayed
|
61
|
+
|
62
|
+
Scenario: Cookbook includes local recipe - name in metadata
|
63
|
+
Given a cookbook recipe that includes a local recipe where the directory is differently named
|
64
|
+
When I check the cookbook
|
65
|
+
Then the undeclared dependency warning 007 should not be displayed
|
66
|
+
|
67
|
+
Scenario: Cookbook has no metadata file
|
68
|
+
Given a cookbook that does not have defined metadata
|
69
|
+
When I check the cookbook
|
70
|
+
Then the undeclared dependency warning 007 should not be displayed
|
71
|
+
And no error should have occurred
|
@@ -0,0 +1,25 @@
|
|
1
|
+
Feature: Check for boilerplate metadata
|
2
|
+
|
3
|
+
In order to ensure that recipe metadata is accurate
|
4
|
+
As a developer
|
5
|
+
I want to identify metadata that has not been changed from the generated defaults
|
6
|
+
|
7
|
+
Scenario: Unmodified knife generated metadata
|
8
|
+
Given a cookbook that has the default boilerplate metadata generated by knife
|
9
|
+
When I check the cookbook
|
10
|
+
Then the boilerplate metadata warning 008 should be displayed against the metadata file
|
11
|
+
|
12
|
+
Scenario Outline: Boilerplate maintainer metadata
|
13
|
+
Given a cookbook that has maintainer metadata set to <maintainer> and <maintainer_email>
|
14
|
+
When I check the cookbook
|
15
|
+
Then the boilerplate metadata warning 008 should warn on lines <lines>
|
16
|
+
|
17
|
+
Examples:
|
18
|
+
| maintainer | maintainer_email | lines |
|
19
|
+
| unspecified | unspecified | |
|
20
|
+
| YOUR_COMPANY_NAME | unspecified | 1 |
|
21
|
+
| unspecified | YOUR_EMAIL | 1 |
|
22
|
+
| YOUR_COMPANY_NAME | foo@example.com | 1 |
|
23
|
+
| Example Ltd | YOUR_EMAIL | 2 |
|
24
|
+
| YOUR_COMPANY_NAME | YOUR_EMAIL | 1,2 |
|
25
|
+
| Example Ltd | foo@example.com | |
|
@@ -0,0 +1,77 @@
|
|
1
|
+
Feature: Check for unrecognised resource attributes
|
2
|
+
|
3
|
+
In order to identify typos in recipes without the need for a converge
|
4
|
+
As a developer
|
5
|
+
I want to identify use of standard resources with unrecognised attributes
|
6
|
+
|
7
|
+
Scenario Outline: Unrecognised attribute declared on built-in resource
|
8
|
+
Given a recipe that declares a <type> resource with these attributes: <attributes>
|
9
|
+
When I check the cookbook
|
10
|
+
Then the unrecognised attribute warning 009 should be <shown>
|
11
|
+
Examples:
|
12
|
+
| type | attributes | shown |
|
13
|
+
| file | punter,group,mode,action | true |
|
14
|
+
| file | owner,group,rights,action | false |
|
15
|
+
| file | owner,group,mode,action | false |
|
16
|
+
| file | action,retries | false |
|
17
|
+
| group | gid | false |
|
18
|
+
| group | gid,membranes | true |
|
19
|
+
| package | version,action,options | false |
|
20
|
+
| package | verison,action,options | true |
|
21
|
+
|
22
|
+
Scenario: Resource declared using recognised attributes
|
23
|
+
Given a recipe that declares a resource with standard attributes
|
24
|
+
When I check the cookbook
|
25
|
+
Then the unrecognised attribute warning 009 should not be displayed
|
26
|
+
|
27
|
+
Scenario: LWRP Resource
|
28
|
+
Given a recipe that declares a user-defined resource
|
29
|
+
When I check the cookbook
|
30
|
+
Then the unrecognised attribute warning 009 should not be displayed
|
31
|
+
And no error should have occurred
|
32
|
+
|
33
|
+
Scenario: Resource declared with only a name attribute
|
34
|
+
Given a recipe that declares a resource with only a name attribute
|
35
|
+
When I check the cookbook
|
36
|
+
Then the unrecognised attribute warning 009 should not be displayed
|
37
|
+
|
38
|
+
Scenario: Unrecognised attribute on recipe with multiple resources of the same type
|
39
|
+
Given a recipe that declares multiple resources of the same type of which one has a bad attribute
|
40
|
+
When I check the cookbook
|
41
|
+
Then the unrecognised attribute warning 009 should be displayed against the correct resource
|
42
|
+
|
43
|
+
Scenario: Resource with conditional attributes
|
44
|
+
Given a recipe that declares a resource with recognised attributes and a conditional execution ruby block
|
45
|
+
When I check the cookbook
|
46
|
+
Then the unrecognised attribute warning 009 should not be displayed
|
47
|
+
|
48
|
+
Scenario: Resource with nested block
|
49
|
+
Given a recipe that declares a resource with recognised attributes and a nested block
|
50
|
+
When I check the cookbook
|
51
|
+
Then the unrecognised attribute warning 009 should not be displayed
|
52
|
+
|
53
|
+
Scenario: Resource with attribute method call
|
54
|
+
Given a recipe that declares a resource with an attribute value set to the result of a method call
|
55
|
+
When I check the cookbook
|
56
|
+
Then the unrecognised attribute warning 009 should not be displayed
|
57
|
+
|
58
|
+
Scenario Outline: Install package with yum specifying architecture
|
59
|
+
Given a recipe that installs a package with yum specifying the architecture
|
60
|
+
When I check the cookbook specifying <version> as the Chef version
|
61
|
+
Then the unrecognised attribute warning 009 should be <shown>
|
62
|
+
Examples:
|
63
|
+
| version | shown |
|
64
|
+
| 0.8.14 | true |
|
65
|
+
| 0.9.6 | true |
|
66
|
+
| 0.9.8 | false |
|
67
|
+
|
68
|
+
Scenario Outline: Retry a resource on failure
|
69
|
+
Given a recipe that installs a gem with 5 retries
|
70
|
+
When I check the cookbook specifying <version> as the Chef version
|
71
|
+
Then the unrecognised attribute warning 009 should be <shown>
|
72
|
+
Examples:
|
73
|
+
| version | shown |
|
74
|
+
| 0.8.16 | true |
|
75
|
+
| 0.9.0 | true |
|
76
|
+
| 0.10.2 | true |
|
77
|
+
| 0.10.4 | false |
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Feature: Check for invalid search syntax
|
2
|
+
|
3
|
+
In order to identify invalid search syntax that will cause my converge to fail
|
4
|
+
As a developer
|
5
|
+
I want to verify that search expressions use valid Lucene syntax
|
6
|
+
|
7
|
+
Scenario: Invalid search syntax
|
8
|
+
Given a cookbook recipe that attempts to perform a search with invalid syntax
|
9
|
+
When I check the cookbook
|
10
|
+
Then the invalid search syntax warning 010 should be displayed
|
11
|
+
|
12
|
+
Scenario: Valid search syntax
|
13
|
+
Given a cookbook recipe that attempts to perform a search with valid syntax
|
14
|
+
When I check the cookbook
|
15
|
+
Then the invalid search syntax warning 010 should not be displayed
|
16
|
+
|
17
|
+
Scenario: Search with subexpression
|
18
|
+
Given a cookbook recipe that attempts to perform a search with a subexpression
|
19
|
+
When I check the cookbook
|
20
|
+
Then the invalid search syntax warning 010 should not be displayed
|