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,26 @@
|
|
1
|
+
Feature: Check for direct usage of curl or wget
|
2
|
+
|
3
|
+
In order to fetch remote artefacts idiomatically
|
4
|
+
As a developer
|
5
|
+
I want to use resources to download rather than using curl or wget
|
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 curl or wget commands warning 041 <display> be displayed
|
11
|
+
Examples:
|
12
|
+
| name | display |
|
13
|
+
| curl 'http://example.org/' | should |
|
14
|
+
| wget 'http://example.org/' | should |
|
15
|
+
| which foo | should not |
|
16
|
+
|
17
|
+
Scenario Outline: Execute resource
|
18
|
+
Given a cookbook recipe with an execute resource that runs the command <command>
|
19
|
+
When I check the cookbook
|
20
|
+
Then the execute resource used to run curl or wget commands warning 041 <display> be displayed
|
21
|
+
Examples:
|
22
|
+
| command | display |
|
23
|
+
| which foo | should not |
|
24
|
+
| curl 'http://example.org/' | should |
|
25
|
+
| wget 'http://example.org/' | should |
|
26
|
+
| mkdir foo && wget 'http://example.org/' | should |
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Feature: Check for deprecated require recipe
|
2
|
+
|
3
|
+
In order to prevent failure of my cookbooks in future versions of Chef
|
4
|
+
As a developer
|
5
|
+
I want to use include_recipe in preference to require_recipe
|
6
|
+
|
7
|
+
Scenario: Recipe uses require_recipe
|
8
|
+
Given a recipe that uses require_recipe
|
9
|
+
When I check the cookbook
|
10
|
+
Then the require_recipe deprecated warning 042 should be displayed
|
11
|
+
|
12
|
+
Scenario: Recipe does not use require_recipe
|
13
|
+
Given a recipe that uses include_recipe
|
14
|
+
When I check the cookbook
|
15
|
+
Then the require_recipe deprecated warning 042 should not be displayed
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Feature: Check for old notification style
|
2
|
+
|
3
|
+
In order to be able to notify a resource that has not yet been declared
|
4
|
+
As a developer
|
5
|
+
I want to use the new-style notification syntax
|
6
|
+
|
7
|
+
Scenario: No notification
|
8
|
+
Given a cookbook recipe with no notifications
|
9
|
+
When I check the cookbook
|
10
|
+
Then the prefer new notification syntax warning 043 should not be displayed
|
11
|
+
|
12
|
+
Scenario: New-style notification
|
13
|
+
Given a cookbook recipe with a resource that notifies a service to restart
|
14
|
+
When I check the cookbook
|
15
|
+
Then the prefer new notification syntax warning 043 should not be displayed
|
16
|
+
|
17
|
+
Scenario: Old-style notification
|
18
|
+
Given a cookbook recipe with a resource that uses the old notification syntax
|
19
|
+
When I check the cookbook
|
20
|
+
Then the prefer new notification syntax warning 043 should be displayed
|
21
|
+
|
22
|
+
Scenario Outline: Applicability by Chef version
|
23
|
+
Given a cookbook recipe with a resource that uses the old notification syntax
|
24
|
+
When I check the cookbook specifying <version> as the Chef version
|
25
|
+
Then the prefer new notification syntax warning 043 <displayed> be displayed
|
26
|
+
Examples:
|
27
|
+
| version | displayed |
|
28
|
+
| 0.7.6 | should not |
|
29
|
+
| 0.8.16 | should not |
|
30
|
+
| 0.9.0 | should not |
|
31
|
+
| 0.9.10 | should |
|
32
|
+
| 0.9.18 | should |
|
33
|
+
| 0.10.0 | should |
|
34
|
+
| 10.24.0 | should |
|
35
|
+
| 11.4.0 | should |
|
@@ -0,0 +1,43 @@
|
|
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
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Feature: Check for cookbook name in metadata
|
2
|
+
|
3
|
+
In order to avoid complications where a cookbook repository name differs from the cookbook name
|
4
|
+
As a developer
|
5
|
+
I want to set the cookbook name within the metadata
|
6
|
+
|
7
|
+
Scenario: Name specified in metadata
|
8
|
+
Given a cookbook with metadata that specifies the cookbook name
|
9
|
+
When I check the cookbook
|
10
|
+
Then the consider setting cookbook name warning 045 should not be displayed against the metadata file
|
11
|
+
|
12
|
+
Scenario: Name not specified in metadata
|
13
|
+
Given a cookbook with metadata that does not specify the cookbook name
|
14
|
+
When I check the cookbook
|
15
|
+
Then the consider setting cookbook name warning 045 should be displayed against the metadata file
|
16
|
+
|
17
|
+
Scenario: No cookbook metadata
|
18
|
+
Given a cookbook that does not have defined metadata
|
19
|
+
When I check the cookbook
|
20
|
+
Then the consider setting cookbook name warning 045 should be displayed against the metadata file
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: Check for attributes using assign unless nil
|
2
|
+
|
3
|
+
In order to avoid attributes being assigned unexpected values
|
4
|
+
As a developer
|
5
|
+
I want to identify attributes that attempt to use assign unless nil (||=)
|
6
|
+
|
7
|
+
Scenario Outline: Attribute assignments
|
8
|
+
Given a cookbook attributes file with assignment <assignment>
|
9
|
+
When I check the cookbook
|
10
|
+
Then the attribute assignment uses assign unless nil warning 046 <show_warning> be displayed against the attributes file
|
11
|
+
Examples:
|
12
|
+
| assignment | show_warning |
|
13
|
+
| default['somevalue'] = [] | should not |
|
14
|
+
| default['somevalue'] = foo \|\| bar | should not |
|
15
|
+
| default['somevalue'] \|\|= [] | should |
|
16
|
+
| default[:somevalue] = [] | should not |
|
17
|
+
| default[:somevalue] = foo \|\| bar | should not |
|
18
|
+
| default[:somevalue] \|\|= [] | should |
|
19
|
+
| default.somevalue = [] | should not |
|
20
|
+
| default.somevalue = foo \|\| bar | should not |
|
21
|
+
| default.somevalue \|\|= [] | should |
|
@@ -0,0 +1,99 @@
|
|
1
|
+
@build
|
2
|
+
Feature: Build framework support
|
3
|
+
|
4
|
+
In order to make it as easy as possible to lint my cookbook
|
5
|
+
As a developer
|
6
|
+
I want to be able to invoke the lint tool from my build
|
7
|
+
|
8
|
+
Scenario: List rake tasks
|
9
|
+
Given a cookbook that has a Gemfile that includes rake and foodcritic
|
10
|
+
And a Rakefile that defines a lint task with no block
|
11
|
+
When I list the available build tasks
|
12
|
+
Then the lint task will be listed
|
13
|
+
|
14
|
+
Scenario: List rake tasks - modified name
|
15
|
+
Given a cookbook that has a Gemfile that includes rake and foodcritic
|
16
|
+
And a Rakefile that defines a lint task specifying a different name
|
17
|
+
When I list the available build tasks
|
18
|
+
Then the lint task will be listed under the different name
|
19
|
+
|
20
|
+
Scenario Outline: Rakefile with no lint task
|
21
|
+
Given a cookbook that has <problems> problems
|
22
|
+
And the cookbook has a Gemfile that includes rake and foodcritic
|
23
|
+
And a Rakefile that defines no lint task
|
24
|
+
When I run the build
|
25
|
+
Then the build will <build_outcome> with no warnings
|
26
|
+
Examples:
|
27
|
+
| problems | build_outcome |
|
28
|
+
| no | succeed |
|
29
|
+
| style | succeed |
|
30
|
+
|
31
|
+
Scenario Outline: Lint task with no block
|
32
|
+
Given a cookbook that has <problems> problems
|
33
|
+
And the cookbook has a Gemfile that includes rake and foodcritic
|
34
|
+
And a Rakefile that defines a lint task with no block
|
35
|
+
When I run the build
|
36
|
+
Then the build will <build_outcome> with warnings <warnings>
|
37
|
+
Examples:
|
38
|
+
| problems | build_outcome | warnings |
|
39
|
+
| no | succeed | |
|
40
|
+
| style | succeed | FC002 |
|
41
|
+
| correctness | fail | FC006 |
|
42
|
+
| style,correctness | fail | FC002,FC006 |
|
43
|
+
|
44
|
+
Scenario Outline: Lint task with empty block
|
45
|
+
Given a cookbook that has <problems> problems
|
46
|
+
And the cookbook has a Gemfile that includes rake and foodcritic
|
47
|
+
And a Rakefile that defines a lint task with an empty block
|
48
|
+
When I run the build
|
49
|
+
Then the build will <build_outcome> with warnings <warnings>
|
50
|
+
Examples:
|
51
|
+
| problems | build_outcome | warnings |
|
52
|
+
| no | succeed | |
|
53
|
+
| style | succeed | FC002 |
|
54
|
+
| style,correctness | fail | FC002,FC006 |
|
55
|
+
|
56
|
+
Scenario Outline: Specify rule tags to fail on
|
57
|
+
Given a cookbook that has <problems> problems
|
58
|
+
And the cookbook has a Gemfile that includes rake and foodcritic
|
59
|
+
And a Rakefile that defines a lint task with a block setting options to <options>
|
60
|
+
When I run the build
|
61
|
+
Then the build will <build_outcome> with warnings <warnings>
|
62
|
+
Examples:
|
63
|
+
| problems | options | build_outcome | warnings |
|
64
|
+
| no | | succeed | |
|
65
|
+
| style,correctness | {:fail_tags => []} | succeed | FC002,FC006 |
|
66
|
+
| correctness | {:fail_tags => ['correctness']} | fail | FC006 |
|
67
|
+
| style | {:fail_tags => ['correctness,style']} | fail | FC002 |
|
68
|
+
| style,correctness | {:fail_tags => [], :tags => ['correctness']} | succeed | FC006 |
|
69
|
+
|
70
|
+
Scenario Outline: Specify paths to lint
|
71
|
+
Given a cookbook that has <problems> problems
|
72
|
+
And the cookbook has a Gemfile that includes rake and foodcritic
|
73
|
+
And a Rakefile that defines a lint task specifying files to lint as <files>
|
74
|
+
When I run the build
|
75
|
+
Then the build will <build_outcome> with warnings <warnings>
|
76
|
+
Examples:
|
77
|
+
| problems | files | build_outcome | warnings |
|
78
|
+
| no | ['recipes/default.rb'] | succeed | |
|
79
|
+
| correctness | ['recipes/default.rb'] | fail | FC006 |
|
80
|
+
| no | ['recipes/default.rb', 'recipes/server.rb'] | succeed | |
|
81
|
+
| correctness | ['recipes/default.rb', 'recipes/server.rb'] | fail | FC006 |
|
82
|
+
|
83
|
+
Scenario: Exclude tests
|
84
|
+
Given a cookbook that has style problems
|
85
|
+
And the cookbook has a Gemfile that includes rake and foodcritic
|
86
|
+
And a Rakefile that defines a lint task with no block
|
87
|
+
And unit tests under a top-level test directory
|
88
|
+
When I run the build
|
89
|
+
Then no warnings will be displayed against the tests
|
90
|
+
And the build will succeed with warnings FC002
|
91
|
+
|
92
|
+
Scenario: Exclude vendored gems
|
93
|
+
Given a cookbook that has style problems
|
94
|
+
And the cookbook has a Gemfile that includes rake and foodcritic
|
95
|
+
And a Rakefile that defines a lint task with no block
|
96
|
+
And the gems have been vendored
|
97
|
+
When I run the build
|
98
|
+
Then no warnings will be displayed against the tests
|
99
|
+
And the build will succeed with warnings FC002
|
@@ -0,0 +1,40 @@
|
|
1
|
+
Feature: Checking all types of files
|
2
|
+
|
3
|
+
In order to run foodcritic rules
|
4
|
+
As a developer
|
5
|
+
I want to be able to check all types of files
|
6
|
+
|
7
|
+
Scenario: Checking recipe
|
8
|
+
Given a cookbook with a recipe file with an interpolated name
|
9
|
+
When I check the cookbook
|
10
|
+
Then the string interpolation warning 002 should be displayed
|
11
|
+
|
12
|
+
Scenario: Checking attribute
|
13
|
+
Given a cookbook with an attribute file with an interpolated name
|
14
|
+
When I check the cookbook
|
15
|
+
Then the string interpolation warning 002 should be displayed against the attributes file
|
16
|
+
|
17
|
+
Scenario: Checking metadata
|
18
|
+
Given a cookbook with a metadata file with an interpolated name
|
19
|
+
When I check the cookbook
|
20
|
+
Then the string interpolation warning 002 should be displayed against the metadata file
|
21
|
+
|
22
|
+
Scenario: Checking provider
|
23
|
+
Given a cookbook with a provider file with an interpolated name
|
24
|
+
When I check the cookbook
|
25
|
+
Then the string interpolation warning 002 should be displayed against the provider file
|
26
|
+
|
27
|
+
Scenario: Checking resource
|
28
|
+
Given a cookbook with a resource file with an interpolated name
|
29
|
+
When I check the cookbook
|
30
|
+
Then the string interpolation warning 002 should be displayed against the resource file
|
31
|
+
|
32
|
+
Scenario: Checking library
|
33
|
+
Given a cookbook with a library file with an interpolated name
|
34
|
+
When I check the cookbook
|
35
|
+
Then the string interpolation warning 002 should be displayed against the libraries file
|
36
|
+
|
37
|
+
Scenario: Checking definition
|
38
|
+
Given a cookbook with a definition file with an interpolated name
|
39
|
+
When I check the cookbook
|
40
|
+
Then the string interpolation warning 002 should be displayed against the definition file
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Feature: Choose rules to apply
|
2
|
+
|
3
|
+
In order to remove warnings that are not appropriate for my usage of Chef
|
4
|
+
As a developer
|
5
|
+
I want to be able to filter the rules applied based on tags associated with each rule
|
6
|
+
|
7
|
+
Scenario Outline: Specified tags on command line
|
8
|
+
Given a cookbook that matches rules <cookbook_matches>
|
9
|
+
When I check the cookbook specifying tags <tag_arguments>
|
10
|
+
Then the warnings shown should be <warnings_shown>
|
11
|
+
|
12
|
+
Examples:
|
13
|
+
| cookbook_matches | tag_arguments | warnings_shown |
|
14
|
+
| FC002,FC003,FC004 | | FC002,FC003,FC004 |
|
15
|
+
| FC002 | -t FC002 | FC002 |
|
16
|
+
| FC002,FC003,FC004 | --tags FC002 | FC002 |
|
17
|
+
| FC002,FC003,FC004 | --tags fc002 | |
|
18
|
+
| FC002,FC003,FC004 | --tags FC005 | |
|
19
|
+
| FC002,FC003,FC004 | --tags ~FC002 | FC003,FC004 |
|
20
|
+
| | --tags FC002 | |
|
21
|
+
| FC002,FC003,FC004 | --tags @FC002 | |
|
22
|
+
| FC002,FC003,FC004 | --tags style | FC002,FC004 |
|
23
|
+
| FC002,FC003,FC004 | --tags FC002 --tags FC003 | |
|
24
|
+
| FC002,FC003,FC004 | --tags style --tags services | FC004 |
|
25
|
+
| FC002,FC003,FC004 | --tags style,services | FC002,FC004 |
|
26
|
+
|
27
|
+
Scenario Outline: Specified tags in cookbook .foodcritic file
|
28
|
+
Given a cookbook that matches rules <cookbook_matches>
|
29
|
+
When the cookbook directory has a .foodcritic file specifying tags <tag_file>
|
30
|
+
And I check the cookbook specifying tags <tag_arguments>
|
31
|
+
Then the warnings shown should be <warnings_shown>
|
32
|
+
|
33
|
+
Examples:
|
34
|
+
| cookbook_matches | tag_file | tag_arguments | warnings_shown |
|
35
|
+
| FC002,FC003,FC004 | | | FC002,FC003,FC004 |
|
36
|
+
| FC002 | FC002 | | FC002 |
|
37
|
+
| FC002 | ~FC002 | --tags FC002 | FC002 |
|
38
|
+
| FC002 | fc002 | | |
|
39
|
+
| FC002,FC003,FC004 | FC005 | | |
|
40
|
+
| FC002,FC003,FC004 | FC005 | -t FC002 | FC002 |
|
41
|
+
| FC002,FC003,FC004 | FC002 | -t FC003 | FC003 |
|
42
|
+
| FC002,FC003,FC004 | ~FC002 | | FC003,FC004 |
|
43
|
+
| FC002,FC003,FC004 | ~FC002 | -t FC002,FC003 | FC002,FC003 |
|
44
|
+
| | FC002 | | |
|
45
|
+
| FC002,FC003,FC004 | @FC002 | | |
|
46
|
+
| FC002,FC003,FC004 | style | | FC002,FC004 |
|
47
|
+
| FC002,FC003,FC004 | FC002 FC003 | | |
|
48
|
+
| FC002,FC003,FC004 | style,services | | FC002,FC004 |
|
49
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
Feature: Command line help
|
2
|
+
|
3
|
+
In order to be able to learn about the options available for checking my cookbooks
|
4
|
+
As a developer
|
5
|
+
I want to be able to interactively get help on the options from the command line
|
6
|
+
|
7
|
+
Scenario: No arguments
|
8
|
+
Given I have installed the lint tool
|
9
|
+
When I run it on the command line with no arguments
|
10
|
+
Then the simple usage text should be displayed along with a non-zero exit code
|
11
|
+
|
12
|
+
Scenario: Non-existent cookbook directory
|
13
|
+
Given I have installed the lint tool
|
14
|
+
When I run it on the command line specifying a cookbook that does not exist
|
15
|
+
Then the simple usage text should be displayed along with a non-zero exit code
|
16
|
+
|
17
|
+
Scenario: Command help
|
18
|
+
Given I have installed the lint tool
|
19
|
+
When I run it on the command line with the help option
|
20
|
+
Then the simple usage text should be displayed along with a zero exit code
|
21
|
+
|
22
|
+
Scenario: Display version
|
23
|
+
Given I have installed the lint tool
|
24
|
+
When I run it on the command line with the version option
|
25
|
+
Then the current version should be displayed
|
26
|
+
|
27
|
+
Scenario: Future verbose option
|
28
|
+
Given I have installed the lint tool
|
29
|
+
When I run it on the command line with the unimplemented verbose option
|
30
|
+
Then the simple usage text should be displayed along with a non-zero exit code
|
31
|
+
|
32
|
+
Scenario: Unimplemented option
|
33
|
+
Given I have installed the lint tool
|
34
|
+
When I run it on the command line with the unimplemented -Z option
|
35
|
+
Then the simple usage text should be displayed along with a non-zero exit code
|
36
|
+
|
37
|
+
Scenario: Future verbose option plus arguments
|
38
|
+
Given a cookbook that has style problems
|
39
|
+
And I have installed the lint tool
|
40
|
+
When I run it on the command line with the unimplemented -v option with an argument
|
41
|
+
Then the simple usage text should be displayed along with a non-zero exit code
|
42
|
+
Then the style warning 002 should not be displayed
|
43
|
+
And the current version should not be displayed
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Feature: Continuous Integration Support
|
2
|
+
|
3
|
+
In order to be able to quickly identify problems with my cookbooks
|
4
|
+
As a developer
|
5
|
+
I want to be able to fail the build for a subset of warnings
|
6
|
+
|
7
|
+
Scenario: Command help
|
8
|
+
Given I have installed the lint tool
|
9
|
+
When I run it on the command line with the help option
|
10
|
+
Then the usage text should include an option for specifying tags that will fail the build
|
11
|
+
|
12
|
+
Scenario Outline: Fail the build for certain tags
|
13
|
+
Given a cookbook that matches rules <cookbook_matches>
|
14
|
+
When I check the cookbook specifying tags <tag_arguments>
|
15
|
+
Then the warnings shown should be <warnings_shown>
|
16
|
+
And the build status should be <build_status>
|
17
|
+
|
18
|
+
Examples:
|
19
|
+
| cookbook_matches | tag_arguments | warnings_shown | build_status |
|
20
|
+
| FC002,FC003,FC004 | | FC002,FC003,FC004 | successful |
|
21
|
+
| FC002,FC003,FC004 | -t style | FC002,FC004 | successful |
|
22
|
+
| FC002,FC003,FC004 | -f style | FC002,FC003,FC004 | failed |
|
23
|
+
| FC002,FC003,FC004 | -f FC005 | FC002,FC003,FC004 | successful |
|
24
|
+
| FC002,FC003,FC004 | -f FC003,FC004 | FC002,FC003,FC004 | failed |
|
25
|
+
| FC002,FC003,FC004 | --epic-fail FC003 | FC002,FC003,FC004 | failed |
|
26
|
+
| FC002,FC003 | -f any | FC002,FC003 | failed |
|
27
|
+
| FC002,FC003 | -f any -f ~FC014 | FC002,FC003 | failed |
|
28
|
+
| FC002,FC003 | -f any,~FC014 | FC002,FC003 | failed |
|
29
|
+
| FC002 | -f ~FC002 | FC002 | successful |
|
30
|
+
| FC002,FC003 | -f ~FC002 | FC002,FC003 | failed |
|
31
|
+
| FC002,FC003 | -f any -f ~FC002 | FC002,FC003 | failed |
|
32
|
+
| FC002 | -f any,~FC002 | FC002 | failed |
|
33
|
+
| FC002 | -f any -f ~FC002 | FC002 | successful |
|
34
|
+
| FC002,FC003 | -f any,~FC002 | FC002,FC003 | failed |
|
35
|
+
| FC002,FC003 | -f ~FC002 -f ~FC004 | FC002,FC003 | failed |
|
@@ -0,0 +1,51 @@
|
|
1
|
+
Feature: Ignoring rules on per line basis
|
2
|
+
|
3
|
+
To ignore specific warnings on some lines
|
4
|
+
As a developer
|
5
|
+
I want to add an ignore comment
|
6
|
+
|
7
|
+
Scenario Outline: Ignoring
|
8
|
+
Given a file resource declared with the mode 644 with comment <comment>
|
9
|
+
When I check the cookbook
|
10
|
+
Then the warning 006 should <shown>
|
11
|
+
Examples:
|
12
|
+
| comment | shown |
|
13
|
+
| | be shown |
|
14
|
+
| # | be shown |
|
15
|
+
| # foo bar baz | be shown |
|
16
|
+
| # ~FC006 | not be shown |
|
17
|
+
| # ~FC006 is a false positive | not be shown |
|
18
|
+
| #~FC006 | not be shown |
|
19
|
+
| #~FC022 | be shown |
|
20
|
+
| # ~FC006 | not be shown |
|
21
|
+
| # ~FC003,~FC006,~FC009 | not be shown |
|
22
|
+
| # ~FC003 ~FC006 ~FC009 | not be shown |
|
23
|
+
| # ~FC003, ~FC006, ~FC009 | not be shown |
|
24
|
+
| # ~FC003,~FC009 | be shown |
|
25
|
+
| # FC006 | be shown |
|
26
|
+
| # ~ FC006 | be shown |
|
27
|
+
| # fc006 | be shown |
|
28
|
+
| # ~006 | be shown |
|
29
|
+
| # ~style | be shown |
|
30
|
+
| # ~files | not be shown |
|
31
|
+
|
32
|
+
Scenario Outline: Ignoring cookbook level rules
|
33
|
+
Given a cookbook with a single recipe that triggers FC019 with comment <comment>
|
34
|
+
And metadata
|
35
|
+
When I check the cookbook
|
36
|
+
Then the attribute consistency warning 019 should <shown>
|
37
|
+
Examples:
|
38
|
+
| comment | shown |
|
39
|
+
| | be shown |
|
40
|
+
| #~FC019 | be not shown |
|
41
|
+
|
42
|
+
Scenario Outline: Multiple warnings
|
43
|
+
Given a file with multiple errors on one line with comment <comment>
|
44
|
+
When I check the cookbook
|
45
|
+
Then the warnings shown should be <warnings>
|
46
|
+
Examples:
|
47
|
+
| comment | warnings |
|
48
|
+
| | FC002,FC039 |
|
49
|
+
| # ~FC002,~FC007 | FC002 |
|
50
|
+
| # ~FC002,~FC039 | |
|
51
|
+
| # ~FC002 | FC039 |
|