foodcritic 2.2.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/CHANGELOG.md +83 -0
- data/chef_dsl_metadata/chef_0.10.0.json +2 -3
- data/chef_dsl_metadata/chef_0.10.10.json +2 -3
- data/chef_dsl_metadata/chef_0.10.2.json +2 -3
- data/chef_dsl_metadata/chef_0.10.4.json +2 -3
- data/chef_dsl_metadata/chef_0.10.6.json +2 -3
- data/chef_dsl_metadata/chef_0.10.8.json +2 -3
- data/chef_dsl_metadata/chef_0.8.14.json +2 -3
- data/chef_dsl_metadata/chef_0.8.16.json +2 -3
- data/chef_dsl_metadata/chef_0.9.0.json +2 -3
- data/chef_dsl_metadata/chef_0.9.10.json +2 -3
- data/chef_dsl_metadata/chef_0.9.12.json +2 -3
- data/chef_dsl_metadata/chef_0.9.14.json +2 -3
- data/chef_dsl_metadata/chef_0.9.16.json +2 -3
- data/chef_dsl_metadata/chef_0.9.18.json +2 -3
- data/chef_dsl_metadata/chef_0.9.2.json +2 -3
- data/chef_dsl_metadata/chef_0.9.4.json +2 -3
- data/chef_dsl_metadata/chef_0.9.6.json +2 -3
- data/chef_dsl_metadata/chef_0.9.8.json +2 -3
- data/chef_dsl_metadata/chef_10.12.0.json +2 -3
- data/chef_dsl_metadata/chef_10.14.0.json +2 -3
- data/chef_dsl_metadata/chef_10.14.2.json +2 -3
- data/chef_dsl_metadata/chef_10.14.4.json +2 -3
- data/chef_dsl_metadata/chef_10.16.0.json +2 -3
- data/chef_dsl_metadata/chef_10.16.2.json +2 -3
- data/chef_dsl_metadata/chef_10.16.4.json +2 -3
- data/chef_dsl_metadata/chef_10.16.6.json +2 -3
- data/chef_dsl_metadata/chef_10.18.0.json +2 -3
- data/chef_dsl_metadata/chef_10.18.2.json +2 -3
- data/chef_dsl_metadata/chef_10.20.0.json +2 -3
- data/chef_dsl_metadata/chef_10.22.0.json +2 -3
- data/chef_dsl_metadata/chef_10.24.0.json +2 -3
- data/chef_dsl_metadata/chef_10.24.4.json +2 -3
- data/chef_dsl_metadata/chef_10.26.0.json +2 -3
- data/chef_dsl_metadata/chef_11.0.0.json +2 -3
- data/chef_dsl_metadata/chef_11.2.0.json +2 -3
- data/chef_dsl_metadata/chef_11.4.0.json +2 -3
- data/chef_dsl_metadata/chef_11.4.2.json +2 -3
- data/chef_dsl_metadata/chef_11.4.4.json +2 -3
- data/chef_dsl_metadata/chef_11.6.0.json +9734 -0
- data/features/007_check_for_undeclared_recipe_dependencies.feature +18 -34
- data/features/017_check_for_no_lwrp_notifications.feature +25 -0
- data/features/019_check_for_consistent_node_access.feature +1 -0
- data/features/033_check_for_missing_template.feature +20 -64
- data/features/034_check_for_unused_template_variables.feature +44 -0
- data/features/047_check_for_attribute_assignment_without_precedence.feature +47 -0
- data/features/048_check_for_shellout.feature +34 -0
- data/features/049_check_for_role_name_mismatch_with_file_name.feature +31 -0
- data/features/050_check_for_invalid_name.feature +33 -0
- data/features/051_check_for_template_partial_loops.feature +21 -0
- data/features/command_line_help.feature +15 -0
- data/features/ignore_via_line_comments.feature +18 -0
- data/features/individual_file.feature +17 -1
- data/features/multiple_paths.feature +26 -2
- data/features/step_definitions/cookbook_steps.rb +328 -9
- data/features/support/command_helpers.rb +71 -10
- data/features/support/cookbook_helpers.rb +88 -6
- data/lib/foodcritic/api.rb +89 -20
- data/lib/foodcritic/command_line.rb +64 -18
- data/lib/foodcritic/domain.rb +26 -7
- data/lib/foodcritic/dsl.rb +3 -0
- data/lib/foodcritic/linter.rb +93 -61
- data/lib/foodcritic/rake_task.rb +3 -2
- data/lib/foodcritic/rules.rb +105 -14
- data/lib/foodcritic/template.rb +34 -1
- data/lib/foodcritic/version.rb +1 -1
- data/man/foodcritic.1 +13 -1
- data/man/foodcritic.1.ronn +9 -0
- data/spec/foodcritic/api_spec.rb +210 -1
- data/spec/foodcritic/command_line_spec.rb +13 -0
- data/spec/foodcritic/domain_spec.rb +40 -5
- data/spec/foodcritic/linter_spec.rb +19 -22
- data/spec/foodcritic/template_spec.rb +8 -4
- data/spec/regression/expected-output.txt +139 -60
- metadata +31 -26
@@ -4,15 +4,16 @@ Feature: Check for undeclared recipe dependencies
|
|
4
4
|
As a developer
|
5
5
|
I want to identify included recipes that are not expressed in cookbook metadata
|
6
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
|
7
|
+
Scenario Outline: Cookbook includes undeclared recipe dependency
|
8
|
+
Given a cookbook recipe that includes an undeclared recipe dependency <qualifiers>
|
14
9
|
When I check the cookbook
|
15
10
|
Then the undeclared dependency warning 007 should be displayed
|
11
|
+
Examples:
|
12
|
+
| qualifiers |
|
13
|
+
| |
|
14
|
+
| with parentheses |
|
15
|
+
| unscoped |
|
16
|
+
| unscoped with parentheses |
|
16
17
|
|
17
18
|
Scenario: Cookbook includes recipe via expression
|
18
19
|
Given a cookbook recipe that includes a recipe name from an expression
|
@@ -29,41 +30,24 @@ Feature: Check for undeclared recipe dependencies
|
|
29
30
|
| #{cookbook_name}::other |
|
30
31
|
| #{cbk}_other::other |
|
31
32
|
|
32
|
-
Scenario:
|
33
|
-
Given a cookbook recipe that includes
|
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
|
33
|
+
Scenario Outline: Declared dependencies
|
34
|
+
Given a cookbook recipe that includes <dependency_type>
|
49
35
|
When I check the cookbook
|
50
36
|
Then the undeclared dependency warning 007 should not be displayed
|
37
|
+
Examples:
|
38
|
+
| dependency_type |
|
39
|
+
| a declared recipe dependency |
|
40
|
+
| a declared recipe dependency unscoped |
|
41
|
+
| several declared recipe dependencies - block |
|
42
|
+
| several declared recipe dependencies - brace |
|
43
|
+
| a local recipe |
|
44
|
+
| a local recipe where the directory is differently named |
|
51
45
|
|
52
46
|
Scenario: Cookbook includes mix of declared and undeclared recipe dependencies
|
53
47
|
Given a cookbook recipe that includes both declared and undeclared recipe dependencies
|
54
48
|
When I check the cookbook
|
55
49
|
Then the undeclared dependency warning 007 should be displayed only for the undeclared dependencies
|
56
50
|
|
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
51
|
Scenario: Cookbook has no metadata file
|
68
52
|
Given a cookbook that does not have defined metadata
|
69
53
|
When I check the cookbook
|
@@ -23,3 +23,28 @@ Feature: Check for no LWRP notifications
|
|
23
23
|
Given a cookbook that contains a LWRP with multiple notifications
|
24
24
|
When I check the cookbook
|
25
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 |
|
@@ -53,6 +53,7 @@ Feature: Check for consistency in node access
|
|
53
53
|
| reads | strings | platform? | not shown |
|
54
54
|
| reads | symbols | run_list | not shown |
|
55
55
|
| reads | symbols | run_state | not shown |
|
56
|
+
| reads | strings | run_state | not shown |
|
56
57
|
| reads | strings | set | not shown |
|
57
58
|
| reads | strings,symbols | set | shown |
|
58
59
|
|
@@ -4,70 +4,26 @@ Feature: Check for missing template
|
|
4
4
|
As a developer
|
5
5
|
I want to identify template resources that refer to missing templates
|
6
6
|
|
7
|
-
Scenario:
|
8
|
-
Given a cookbook recipe that
|
9
|
-
When I check the cookbook
|
10
|
-
Then the missing template warning 033
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
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 |
|
71
27
|
|
72
28
|
Scenario: Template within deploy resource
|
73
29
|
Given a cookbook recipe with a deploy resource that contains a template resource
|
@@ -35,3 +35,47 @@ Feature: Check for unused template variables
|
|
35
35
|
| config_var,another_var | @another_var | .conf.erb | should |
|
36
36
|
| config_var | @config_var | .conf | should not |
|
37
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
|
81
|
+
And no error should have occurred
|
@@ -0,0 +1,47 @@
|
|
1
|
+
Feature: Check for attribute assignment without specified precedence
|
2
|
+
|
3
|
+
In order to ensure that my cookbooks continue to work with Chef 11+
|
4
|
+
As a developer
|
5
|
+
I want to identify node attribute assignment that does not specify the attribute precedence
|
6
|
+
|
7
|
+
Scenario Outline: Attribute assignment
|
8
|
+
Given a cookbook attributes file with assignment <assignment>
|
9
|
+
When I check the cookbook
|
10
|
+
Then the attribute assignment without precedence warning 047 <show_warning> be displayed against the attributes file
|
11
|
+
Examples:
|
12
|
+
| assignment | show_warning |
|
13
|
+
| node[:foo] = 'bar' | should |
|
14
|
+
| node['foo'] = 'bar' | should |
|
15
|
+
| node['foo'] = a_var | should |
|
16
|
+
| a_var = node['foo'] | should not |
|
17
|
+
| node['foo']['bar'] = 'baz' | should |
|
18
|
+
| node['foo']['bar']['baz'] = 'fizz' | should |
|
19
|
+
| node.foo = 'bar' | should |
|
20
|
+
| node.normal.foo = 'bar' | should not |
|
21
|
+
| node.normal['foo'] = 'bar' | should not |
|
22
|
+
| node.default['foo'] = 'bar' | should not |
|
23
|
+
| node.force_default['foo'] = 'bar' | should not |
|
24
|
+
| node.set['foo'] = 'bar' | should not |
|
25
|
+
| node.override['foo'] = 'bar' | should not |
|
26
|
+
| node.force_override['foo'] = 'bar' | should not |
|
27
|
+
| node.automatic_attrs['foo'] = 'bar' | should not |
|
28
|
+
| node['foos'] << 'bar' | should |
|
29
|
+
| node['foo']['bars'] << 'baz' | should |
|
30
|
+
| foo = node['bar'] | should not |
|
31
|
+
| baz << node['foo']['bars'] | should not |
|
32
|
+
| node.run_state['foo'] = bar | should not |
|
33
|
+
| foo[:bar] << node['baz'] | should not |
|
34
|
+
| node.default['foo'] << bar | should not |
|
35
|
+
| node.default_unless['foo'] = 'bar' | should not |
|
36
|
+
| node.normal_unless['foo'] = 'bar' | should not |
|
37
|
+
| node.set_unless['foo'] = 'bar' | should not |
|
38
|
+
| node.override_unless['foo'] = 'bar' | should not |
|
39
|
+
|
40
|
+
Scenario Outline: Attribute assignment in recipe
|
41
|
+
Given a cookbook recipe file with assignment <assignment>
|
42
|
+
When I check the cookbook
|
43
|
+
Then the attribute assignment without precedence warning 047 <show_warning> be displayed
|
44
|
+
Examples:
|
45
|
+
| assignment | show_warning |
|
46
|
+
| node[:foo] = 'bar' | should |
|
47
|
+
| node.normal['foo'] = 'bar' | should not |
|
@@ -0,0 +1,34 @@
|
|
1
|
+
Feature: Check for spawning without Mixlib::ShellOut
|
2
|
+
|
3
|
+
In order to work more easily with spawned processes
|
4
|
+
As a developer
|
5
|
+
I want to use the Mixlib::ShellOut library rather than basic ruby constructs
|
6
|
+
|
7
|
+
Scenario Outline: Spawning a sub-process
|
8
|
+
Given a cookbook recipe that spawns a sub-process with <command>
|
9
|
+
When I check the cookbook
|
10
|
+
Then the prefer mixlib shellout warning 048 <show_warning> be displayed
|
11
|
+
Examples:
|
12
|
+
| command | show_warning |
|
13
|
+
| `ls` | should |
|
14
|
+
| `#{cmd}` | should |
|
15
|
+
| %x{ls} | should |
|
16
|
+
| %x[ls] | should |
|
17
|
+
| %x{#{cmd} some_dir} | should |
|
18
|
+
| %x{#{cmd} some_dir} | should |
|
19
|
+
| system "ls" | should |
|
20
|
+
| system("ls") | should |
|
21
|
+
| system cmd | should |
|
22
|
+
| system(cmd) | should |
|
23
|
+
| system("#{cmd} some_dir") | should |
|
24
|
+
| Mixlib::ShellOut.new('ls').run_command | should not |
|
25
|
+
|
26
|
+
Scenario: Execute resource
|
27
|
+
Given a cookbook recipe that executes 'ls' with an execute resource
|
28
|
+
When I check the cookbook
|
29
|
+
Then the prefer mixlib shellout warning 048 should not be displayed
|
30
|
+
|
31
|
+
Scenario: Group resource
|
32
|
+
Given a cookbook recipe that contains a group resource that uses the 'system' attribute
|
33
|
+
When I check the cookbook
|
34
|
+
Then the prefer mixlib shellout warning 048 should not be displayed against the group resource
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Feature: Identify roles names that do not match filenames
|
2
|
+
|
3
|
+
In order to avoid confusion
|
4
|
+
As a developer
|
5
|
+
I want to identify roles whose names differ from their filename
|
6
|
+
|
7
|
+
Scenario Outline: Illustrates role paths
|
8
|
+
Given a directory that contains a role file <filename> in <format> that defines role name <role_name>
|
9
|
+
When I check the role directory as a <path_type> path
|
10
|
+
Then the role name does not match file name warning 049 <show_warning> be shown
|
11
|
+
Examples:
|
12
|
+
| filename | format | role_name | path_type | show_warning |
|
13
|
+
| webserver.rb | ruby | webserver | role | should not |
|
14
|
+
| webserver.rb | ruby | apache | role | should |
|
15
|
+
| webserver.json | json | webserver | role | should not |
|
16
|
+
| webserver.json | json | apache | role | should not |
|
17
|
+
| webserver.rb | ruby | webserver | cookbook | should not |
|
18
|
+
| webserver.rb | ruby | apache | cookbook | should not |
|
19
|
+
| webserver.rb | ruby | webserver | default | should not |
|
20
|
+
| webserver.rb | ruby | apache | default | should not |
|
21
|
+
|
22
|
+
Scenario: Role name references variable
|
23
|
+
Given a directory that contains a ruby role with an expression as its name
|
24
|
+
When I check the role directory
|
25
|
+
Then the role name does not match file name warning 049 should not be shown
|
26
|
+
|
27
|
+
Scenario: Multiple role names declared
|
28
|
+
Given a directory that contains a ruby role that declares the role name more than once
|
29
|
+
And the last role name declared does not match the containing filename
|
30
|
+
When I check the role directory
|
31
|
+
Then the role name does not match file name warning 049 should be shown against the second name
|
@@ -0,0 +1,33 @@
|
|
1
|
+
Feature: Check for invalid names
|
2
|
+
|
3
|
+
In order to identify issues more quickly
|
4
|
+
As a developer
|
5
|
+
I want to identify roles or environments whose names are invalid
|
6
|
+
|
7
|
+
Scenario Outline: Role name validity
|
8
|
+
Given a ruby role file that defines a role with name <role_name>
|
9
|
+
When I check the role directory
|
10
|
+
Then the invalid role name warning 050 <show_warning> be shown
|
11
|
+
Examples:
|
12
|
+
| role_name | show_warning |
|
13
|
+
| webserver | should not |
|
14
|
+
| web_server | should not |
|
15
|
+
| web-server | should not |
|
16
|
+
| webserver123 | should not |
|
17
|
+
| Webserver | should not |
|
18
|
+
| web server | should |
|
19
|
+
| webserver% | should |
|
20
|
+
|
21
|
+
Scenario Outline: Environment name validity
|
22
|
+
Given a ruby environment file that defines an environment with name <environment_name>
|
23
|
+
When I check the environment directory
|
24
|
+
Then the invalid environment name warning 050 <show_warning> be shown
|
25
|
+
Examples:
|
26
|
+
| environment_name | show_warning |
|
27
|
+
| production | should not |
|
28
|
+
| pre_production | should not |
|
29
|
+
| production-eu | should not |
|
30
|
+
| production2 | should not |
|
31
|
+
| Production | should not |
|
32
|
+
| EU West | should |
|
33
|
+
| production (eu-west) | should |
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: Check for template partial includes cycle
|
2
|
+
|
3
|
+
In order to avoid failures at converge time
|
4
|
+
As a developer
|
5
|
+
I want to identify when a template uses partials that would loop
|
6
|
+
|
7
|
+
Scenario: Template without includes
|
8
|
+
Given a cookbook recipe that refers to a template
|
9
|
+
When I check the cookbook
|
10
|
+
Then the template partials loop indefinitely warning 051 should not be displayed against the templates
|
11
|
+
|
12
|
+
Scenario: Template includes do not cycle
|
13
|
+
Given a template that includes a partial
|
14
|
+
When I check the cookbook
|
15
|
+
Then the template partials loop indefinitely warning 051 should not be displayed against the templates
|
16
|
+
|
17
|
+
Scenario: Template includes contain cycle
|
18
|
+
Given a template that includes a partial that includes the original template again
|
19
|
+
When I check the cookbook
|
20
|
+
Then the template partials loop indefinitely warning 051 should be displayed against the templates
|
21
|
+
And no error should have occurred
|
@@ -14,6 +14,16 @@ Feature: Command line help
|
|
14
14
|
When I run it on the command line specifying a cookbook that does not exist
|
15
15
|
Then the simple usage text should be displayed along with a non-zero exit code
|
16
16
|
|
17
|
+
Scenario: Non-existent role directory
|
18
|
+
Given I have installed the lint tool
|
19
|
+
When I run it on the command line specifying a role directory that does not exist
|
20
|
+
Then the simple usage text should be displayed along with a non-zero exit code
|
21
|
+
|
22
|
+
Scenario: Non-existent environment directory
|
23
|
+
Given I have installed the lint tool
|
24
|
+
When I run it on the command line specifying an environment directory that does not exist
|
25
|
+
Then the simple usage text should be displayed along with a non-zero exit code
|
26
|
+
|
17
27
|
Scenario: Command help
|
18
28
|
Given I have installed the lint tool
|
19
29
|
When I run it on the command line with the help option
|
@@ -41,3 +51,8 @@ Feature: Command line help
|
|
41
51
|
Then the simple usage text should be displayed along with a non-zero exit code
|
42
52
|
Then the style warning 002 should not be displayed
|
43
53
|
And the current version should not be displayed
|
54
|
+
|
55
|
+
Scenario: Refer to the man page
|
56
|
+
Given access to the man page documentation
|
57
|
+
When I compare the man page options against the usage options
|
58
|
+
Then all options should be documented in the man page
|