foodcritic 15.0.0 → 15.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/chef_dsl_metadata/{chef_14.7.17.json → chef_14.8.12.json} +61 -1
- data/foodcritic.gemspec +1 -3
- data/lib/foodcritic/linter.rb +1 -1
- data/lib/foodcritic/version.rb +1 -1
- metadata +5 -232
- data/Rakefile +0 -73
- data/features/002_check_string_interpolation.feature +0 -50
- data/features/005_check_for_resource_repetition.feature +0 -64
- data/features/006_check_file_mode.feature +0 -36
- data/features/009_check_for_unrecognised_resource_attributes.feature +0 -55
- data/features/014_check_for_long_ruby_blocks.feature +0 -30
- data/features/018_check_for_old_lwrp_notification_syntax.feature +0 -25
- data/features/019_check_for_consistent_node_access.feature +0 -108
- data/features/021_check_for_dodgy_lwrp_conditions.feature +0 -28
- data/features/022_check_for_dodgy_conditions_within_loop.feature +0 -43
- data/features/024_check_for_missing_platforms.feature +0 -43
- data/features/027_check_for_internal_attribute_use.feature +0 -22
- data/features/030_check_for_debugger_breakpoints.feature +0 -25
- data/features/032_check_for_invalid_notification_timing.feature +0 -24
- data/features/033_check_for_missing_template.feature +0 -39
- data/features/034_check_for_unused_template_variables.feature +0 -80
- data/features/037_check_for_invalid_notification_action.feature +0 -34
- data/features/038_check_for_invalid_action.feature +0 -39
- data/features/039_check_for_key_access_to_node_methods.feature +0 -33
- data/features/044_check_for_bare_attribute_keys.feature +0 -53
- data/features/046_check_for_assign_unless_nil_attributes.feature +0 -21
- data/features/047_check_for_attribute_assignment_without_precedence.feature +0 -49
- data/features/051_check_for_template_partial_loops.feature +0 -40
- data/features/build_framework_support.feature +0 -109
- data/features/checking_all_types_of_file.feature +0 -40
- data/features/choose_rules_to_apply.feature +0 -47
- data/features/command_line_help.feature +0 -58
- data/features/continuous_integration_support.feature +0 -33
- data/features/exclude_paths_to_lint.feature +0 -12
- data/features/ignore_via_line_comments.feature +0 -69
- data/features/include_custom_rules.feature +0 -29
- data/features/individual_file.feature +0 -28
- data/features/limit_rules_to_specific_versions.feature +0 -65
- data/features/multiple_paths.feature +0 -35
- data/features/show_lines_matched.feature +0 -20
- data/features/sort_warnings.feature +0 -10
- data/features/specify_search_grammar.feature +0 -25
- data/features/step_definitions/cookbook_steps.rb +0 -1826
- data/features/support/command_helpers.rb +0 -418
- data/features/support/cookbook_helpers.rb +0 -599
- data/features/support/env.rb +0 -19
- data/man/foodcritic.1.ronn +0 -76
- data/spec/functional/fc001_spec.rb +0 -72
- data/spec/functional/fc004_spec.rb +0 -84
- data/spec/functional/fc007_spec.rb +0 -127
- data/spec/functional/fc008_spec.rb +0 -33
- data/spec/functional/fc009_spec.rb +0 -37
- data/spec/functional/fc010_spec.rb +0 -32
- data/spec/functional/fc011_spec.rb +0 -20
- data/spec/functional/fc013_spec.rb +0 -39
- data/spec/functional/fc015_spec.rb +0 -19
- data/spec/functional/fc016_spec.rb +0 -57
- data/spec/functional/fc025_spec.rb +0 -60
- data/spec/functional/fc026_spec.rb +0 -66
- data/spec/functional/fc028_spec.rb +0 -93
- data/spec/functional/fc029_spec.rb +0 -33
- data/spec/functional/fc031_spec.rb +0 -14
- data/spec/functional/fc037_spec.rb +0 -75
- data/spec/functional/fc038_spec.rb +0 -28
- data/spec/functional/fc040_spec.rb +0 -156
- data/spec/functional/fc041_spec.rb +0 -121
- data/spec/functional/fc042_spec.rb +0 -13
- data/spec/functional/fc043_spec.rb +0 -28
- data/spec/functional/fc045_spec.rb +0 -18
- data/spec/functional/fc048_spec.rb +0 -67
- data/spec/functional/fc049_spec.rb +0 -56
- data/spec/functional/fc050_spec.rb +0 -85
- data/spec/functional/fc052_spec.rb +0 -13
- data/spec/functional/fc053_spec.rb +0 -13
- data/spec/functional/fc055_spec.rb +0 -18
- data/spec/functional/fc056_spec.rb +0 -18
- data/spec/functional/fc058_spec.rb +0 -102
- data/spec/functional/fc060_spec.rb +0 -45
- data/spec/functional/fc061_spec.rb +0 -48
- data/spec/functional/fc062_spec.rb +0 -13
- data/spec/functional/fc063_spec.rb +0 -18
- data/spec/functional/fc064_spec.rb +0 -13
- data/spec/functional/fc065_spec.rb +0 -13
- data/spec/functional/fc066_spec.rb +0 -33
- data/spec/functional/fc067_spec.rb +0 -13
- data/spec/functional/fc068_spec.rb +0 -13
- data/spec/functional/fc069_spec.rb +0 -38
- data/spec/functional/fc070_spec.rb +0 -65
- data/spec/functional/fc071_spec.rb +0 -36
- data/spec/functional/fc072_spec.rb +0 -13
- data/spec/functional/fc073_spec.rb +0 -56
- data/spec/functional/fc074_spec.rb +0 -39
- data/spec/functional/fc075_spec.rb +0 -41
- data/spec/functional/fc076_spec.rb +0 -13
- data/spec/functional/fc077_spec.rb +0 -13
- data/spec/functional/fc078_spec.rb +0 -35
- data/spec/functional/fc079_spec.rb +0 -21
- data/spec/functional/fc080_spec.rb +0 -68
- data/spec/functional/fc081_spec.rb +0 -25
- data/spec/functional/fc082_spec.rb +0 -23
- data/spec/functional/fc083_spec.rb +0 -34
- data/spec/functional/fc084_spec.rb +0 -49
- data/spec/functional/fc085_spec.rb +0 -77
- data/spec/functional/fc086_spec.rb +0 -45
- data/spec/functional/fc087_spec.rb +0 -43
- data/spec/functional/fc088_spec.rb +0 -18
- data/spec/functional/fc089_spec.rb +0 -23
- data/spec/functional/fc091_spec.rb +0 -38
- data/spec/functional/fc092_spec.rb +0 -31
- data/spec/functional/fc093_spec.rb +0 -27
- data/spec/functional/fc094_spec.rb +0 -18
- data/spec/functional/fc095_spec.rb +0 -18
- data/spec/functional/fc096_spec.rb +0 -18
- data/spec/functional/fc097_spec.rb +0 -18
- data/spec/functional/fc098_spec.rb +0 -18
- data/spec/functional/fc099_spec.rb +0 -18
- data/spec/functional/fc100_spec.rb +0 -18
- data/spec/functional/fc101_spec.rb +0 -23
- data/spec/functional/fc102_spec.rb +0 -18
- data/spec/functional/fc103_spec.rb +0 -30
- data/spec/functional/fc104_spec.rb +0 -54
- data/spec/functional/fc105_spec.rb +0 -36
- data/spec/functional/fc106_spec.rb +0 -21
- data/spec/functional/fc107_spec.rb +0 -22
- data/spec/functional/fc108_spec.rb +0 -43
- data/spec/functional/fc109_spec.rb +0 -22
- data/spec/functional/fc110_spec.rb +0 -21
- data/spec/functional/fc111_spec.rb +0 -17
- data/spec/functional/fc112_spec.rb +0 -17
- data/spec/functional/fc113_spec.rb +0 -98
- data/spec/functional/fc114_spec.rb +0 -31
- data/spec/functional/fc115_spec.rb +0 -24
- data/spec/functional/fc116_spec.rb +0 -18
- data/spec/functional/fc117_spec.rb +0 -23
- data/spec/functional/fc118_spec.rb +0 -17
- data/spec/functional/fc119_spec.rb +0 -27
- data/spec/functional/fc120_spec.rb +0 -21
- data/spec/functional/fc121_spec.rb +0 -45
- data/spec/functional/fc122_spec.rb +0 -18
- data/spec/functional/root_aliases_spec.rb +0 -13
- data/spec/regression/cookbooks.txt +0 -83
- data/spec/regression/expected/activemq.txt +0 -6
- data/spec/regression/expected/aix.txt +0 -27
- data/spec/regression/expected/apparmor.txt +0 -9
- data/spec/regression/expected/apt.txt +0 -14
- data/spec/regression/expected/ark.txt +0 -3
- data/spec/regression/expected/auditd.txt +0 -2
- data/spec/regression/expected/aws.txt +0 -16
- data/spec/regression/expected/bluepill.txt +0 -12
- data/spec/regression/expected/boost.txt +0 -8
- data/spec/regression/expected/build-essential.txt +0 -8
- data/spec/regression/expected/chef-client.txt +0 -17
- data/spec/regression/expected/chef-ingredient.txt +0 -6
- data/spec/regression/expected/chef-server.txt +0 -13
- data/spec/regression/expected/chef-vault.txt +0 -7
- data/spec/regression/expected/chef.txt +0 -104
- data/spec/regression/expected/chef_client_updater.txt +0 -2
- data/spec/regression/expected/chef_handler.txt +0 -7
- data/spec/regression/expected/chef_hostname.txt +0 -3
- data/spec/regression/expected/chef_nginx.txt +0 -4
- data/spec/regression/expected/cron.txt +0 -7
- data/spec/regression/expected/database.txt +0 -42
- data/spec/regression/expected/dmg.txt +0 -11
- data/spec/regression/expected/docker.txt +0 -4
- data/spec/regression/expected/drbd.txt +0 -29
- data/spec/regression/expected/dynect.txt +0 -33
- data/spec/regression/expected/erlang.txt +0 -6
- data/spec/regression/expected/fail2ban.txt +0 -5
- data/spec/regression/expected/firewall.txt +0 -11
- data/spec/regression/expected/gecode.txt +0 -10
- data/spec/regression/expected/gems.txt +0 -32
- data/spec/regression/expected/gunicorn.txt +0 -11
- data/spec/regression/expected/heartbeat.txt +0 -8
- data/spec/regression/expected/homebrew.txt +0 -7
- data/spec/regression/expected/iis.txt +0 -22
- data/spec/regression/expected/iptables.txt +0 -9
- data/spec/regression/expected/jetty.txt +0 -13
- data/spec/regression/expected/jpackage.txt +0 -9
- data/spec/regression/expected/keepalived.txt +0 -3
- data/spec/regression/expected/kickstart.txt +0 -15
- data/spec/regression/expected/libarchive.txt +0 -6
- data/spec/regression/expected/logwatch.txt +0 -5
- data/spec/regression/expected/lvm.txt +0 -14
- data/spec/regression/expected/maradns.txt +0 -14
- data/spec/regression/expected/maven.txt +0 -8
- data/spec/regression/expected/memcached.txt +0 -31
- data/spec/regression/expected/motd-tail.txt +0 -5
- data/spec/regression/expected/mysql.txt +0 -19
- data/spec/regression/expected/ohai.txt +0 -9
- data/spec/regression/expected/openldap.txt +0 -12
- data/spec/regression/expected/openssh.txt +0 -6
- data/spec/regression/expected/openssl.txt +0 -6
- data/spec/regression/expected/partial_search.txt +0 -7
- data/spec/regression/expected/passenger_apache2.txt +0 -31
- data/spec/regression/expected/perl.txt +0 -14
- data/spec/regression/expected/php.txt +0 -6
- data/spec/regression/expected/postfix.txt +0 -8
- data/spec/regression/expected/powershell.txt +0 -8
- data/spec/regression/expected/resolver.txt +0 -7
- data/spec/regression/expected/rsync.txt +0 -9
- data/spec/regression/expected/rsyslog.txt +0 -11
- data/spec/regression/expected/runit.txt +0 -4
- data/spec/regression/expected/smokeping.txt +0 -6
- data/spec/regression/expected/sql_server.txt +0 -7
- data/spec/regression/expected/ssh_known_hosts.txt +0 -6
- data/spec/regression/expected/stompserver.txt +0 -6
- data/spec/regression/expected/subversion.txt +0 -6
- data/spec/regression/expected/sudo.txt +0 -10
- data/spec/regression/expected/tar.txt +0 -10
- data/spec/regression/expected/tftp.txt +0 -6
- data/spec/regression/expected/tomcat.txt +0 -18
- data/spec/regression/expected/transmission.txt +0 -13
- data/spec/regression/expected/ubuntu.txt +0 -5
- data/spec/regression/expected/ufw.txt +0 -12
- data/spec/regression/expected/unicorn.txt +0 -7
- data/spec/regression/expected/users.txt +0 -12
- data/spec/regression/expected/vcruntime.txt +0 -8
- data/spec/regression/expected/vim.txt +0 -7
- data/spec/regression/expected/webpi.txt +0 -7
- data/spec/regression/expected/whitelist-node-attrs.txt +0 -7
- data/spec/regression/expected/windows.txt +0 -35
- data/spec/regression/expected/wix.txt +0 -5
- data/spec/regression/expected/xml.txt +0 -7
- data/spec/regression/expected/yum.txt +0 -15
- data/spec/regression/regression_spec.rb +0 -23
- data/spec/spec_helper.rb +0 -132
- data/spec/unit/api_spec.rb +0 -1939
- data/spec/unit/chef_spec.rb +0 -66
- data/spec/unit/command_line_spec.rb +0 -136
- data/spec/unit/domain_spec.rb +0 -78
- data/spec/unit/linter_spec.rb +0 -107
- data/spec/unit/template_spec.rb +0 -53
@@ -1,21 +0,0 @@
|
|
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 |
|
@@ -1,49 +0,0 @@
|
|
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.default!['foo'] = 'bar' | should not |
|
25
|
-
| node.set['foo'] = 'bar' | should not |
|
26
|
-
| node.override['foo'] = 'bar' | should not |
|
27
|
-
| node.override!['foo'] = 'bar' | should not |
|
28
|
-
| node.force_override['foo'] = 'bar' | should not |
|
29
|
-
| node.automatic_attrs['foo'] = 'bar' | should not |
|
30
|
-
| node['foos'] << 'bar' | should |
|
31
|
-
| node['foo']['bars'] << 'baz' | should |
|
32
|
-
| foo = node['bar'] | should not |
|
33
|
-
| baz << node['foo']['bars'] | should not |
|
34
|
-
| node.run_state['foo'] = bar | should not |
|
35
|
-
| foo[:bar] << node['baz'] | should not |
|
36
|
-
| node.default['foo'] << bar | should not |
|
37
|
-
| node.default_unless['foo'] = 'bar' | should not |
|
38
|
-
| node.normal_unless['foo'] = 'bar' | should not |
|
39
|
-
| node.set_unless['foo'] = 'bar' | should not |
|
40
|
-
| node.override_unless['foo'] = 'bar' | should not |
|
41
|
-
|
42
|
-
Scenario Outline: Attribute assignment in recipe
|
43
|
-
Given a cookbook recipe file with assignment <assignment>
|
44
|
-
When I check the cookbook
|
45
|
-
Then the attribute assignment without precedence warning 047 <show_warning> be displayed
|
46
|
-
Examples:
|
47
|
-
| assignment | show_warning |
|
48
|
-
| node[:foo] = 'bar' | should |
|
49
|
-
| node.normal['foo'] = 'bar' | should not |
|
@@ -1,40 +0,0 @@
|
|
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
|
-
|
22
|
-
Scenario: Relative partial
|
23
|
-
Given a template that includes a partial with a relative subdirectory path
|
24
|
-
When I check the cookbook
|
25
|
-
Then the template partials loop indefinitely warning 051 should not be displayed against the templates
|
26
|
-
|
27
|
-
Scenario: Missing partial
|
28
|
-
Given a template that includes a missing partial with a relative subdirectory path
|
29
|
-
When I check the cookbook
|
30
|
-
Then the template partials loop indefinitely warning 051 should not be displayed against the templates
|
31
|
-
|
32
|
-
Scenario Outline: Template directory contains binary files
|
33
|
-
Given a template directory that contains a binary file <file> that is not valid UTF-8
|
34
|
-
When I check the cookbook
|
35
|
-
Then the template partials loop indefinitely warning 051 should not be displayed against the templates
|
36
|
-
|
37
|
-
Examples:
|
38
|
-
| file |
|
39
|
-
| .DS_Store |
|
40
|
-
| foo.erb.swp |
|
@@ -1,109 +0,0 @@
|
|
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
|
-
@context
|
71
|
-
Scenario: Specify that contexts should be shown
|
72
|
-
Given a cookbook with a single recipe that reads node attributes via symbols,strings
|
73
|
-
And the cookbook has a Gemfile that includes rake and foodcritic
|
74
|
-
And a Rakefile that defines a lint task with a block setting options to {:context => true}
|
75
|
-
When I run the build
|
76
|
-
Then the recipe filename should be displayed
|
77
|
-
And the attribute consistency warning 019 should be displayed below
|
78
|
-
And the line number and line of code that triggered the warning should be displayed
|
79
|
-
|
80
|
-
Scenario Outline: Specify paths to lint
|
81
|
-
Given a cookbook that has <problems> problems
|
82
|
-
And the cookbook has a Gemfile that includes rake and foodcritic
|
83
|
-
And a Rakefile that defines a lint task specifying files to lint as <files>
|
84
|
-
When I run the build
|
85
|
-
Then the build will <build_outcome> with warnings <warnings>
|
86
|
-
Examples:
|
87
|
-
| problems | files | build_outcome | warnings |
|
88
|
-
| no | ['recipes/default.rb'] | succeed | |
|
89
|
-
| correctness | ['recipes/default.rb'] | fail | FC006 |
|
90
|
-
| no | ['recipes/default.rb', 'recipes/server.rb'] | succeed | |
|
91
|
-
| correctness | ['recipes/default.rb', 'recipes/server.rb'] | fail | FC006 |
|
92
|
-
|
93
|
-
Scenario: Exclude tests
|
94
|
-
Given a cookbook that has style problems
|
95
|
-
And the cookbook has a Gemfile that includes rake and foodcritic
|
96
|
-
And a Rakefile that defines a lint task with no block
|
97
|
-
And unit tests under a top-level test directory
|
98
|
-
When I run the build
|
99
|
-
Then no warnings will be displayed against the tests
|
100
|
-
And the build will succeed with warnings FC002
|
101
|
-
|
102
|
-
Scenario: Exclude vendored gems
|
103
|
-
Given a cookbook that has style problems
|
104
|
-
And the cookbook has a Gemfile that includes rake and foodcritic
|
105
|
-
And a Rakefile that defines a lint task with no block
|
106
|
-
And the gems have been vendored
|
107
|
-
When I run the build
|
108
|
-
Then no warnings will be displayed against the tests
|
109
|
-
And the build will succeed with warnings FC002
|
@@ -1,40 +0,0 @@
|
|
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
|
@@ -1,47 +0,0 @@
|
|
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,FC004,FC005 | | FC002,FC004,FC005 |
|
15
|
-
| FC002 | -t FC002 | FC002 |
|
16
|
-
| FC002,FC004,FC005 | --tags FC002 | FC002 |
|
17
|
-
| FC002,FC004,FC005 | --tags fc002 | |
|
18
|
-
| FC002,FC004,FC005 | --tags FC006 | |
|
19
|
-
| FC002,FC004,FC005 | --tags ~FC002 | FC004,FC005 |
|
20
|
-
| | --tags FC002 | |
|
21
|
-
| FC002,FC004,FC005 | --tags @FC002 | |
|
22
|
-
| FC002,FC004,FC005 | --tags style | FC002 |
|
23
|
-
| FC002,FC004,FC005 | --tags FC002 --tags FC004 | |
|
24
|
-
| FC002,FC004,FC005 | --tags portability --tags services | FC004 |
|
25
|
-
| FC002,FC004,FC005 | --tags style,services,portability | 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,FC004 | | | FC002,FC004 |
|
36
|
-
| FC002 | FC002 | | FC002 |
|
37
|
-
| FC002 | ~FC002 | --tags FC002 | FC002 |
|
38
|
-
| FC002 | fc002 | | |
|
39
|
-
| FC002,FC004 | FC005 | | |
|
40
|
-
| FC002,FC004 | FC005 | -t FC002 | FC002 |
|
41
|
-
| FC002,FC004 | ~FC002 | | FC004 |
|
42
|
-
| FC002,FC004 | ~FC002 | -t FC002 | FC002 |
|
43
|
-
| | FC002 | | |
|
44
|
-
| FC002,FC004 | @FC002 | | |
|
45
|
-
| FC002,FC004 | style | | FC002 |
|
46
|
-
| FC002,FC004 | FC002 | | |
|
47
|
-
| FC002,FC004 | style,portability | | FC002,FC004 |
|
@@ -1,58 +0,0 @@
|
|
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: 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
|
-
|
27
|
-
Scenario: Command help
|
28
|
-
Given I have installed the lint tool
|
29
|
-
When I run it on the command line with the help option
|
30
|
-
Then the simple usage text should be displayed along with a zero exit code
|
31
|
-
|
32
|
-
Scenario: Display version
|
33
|
-
Given I have installed the lint tool
|
34
|
-
When I run it on the command line with the version option
|
35
|
-
Then the current version should be displayed
|
36
|
-
|
37
|
-
Scenario: Future verbose option
|
38
|
-
Given I have installed the lint tool
|
39
|
-
When I run it on the command line with the unimplemented verbose option
|
40
|
-
Then the simple usage text should be displayed along with a non-zero exit code
|
41
|
-
|
42
|
-
Scenario: Unimplemented option
|
43
|
-
Given I have installed the lint tool
|
44
|
-
When I run it on the command line with the unimplemented -Z option
|
45
|
-
Then the simple usage text should be displayed along with a non-zero exit code
|
46
|
-
|
47
|
-
Scenario: Future verbose option plus arguments
|
48
|
-
Given a cookbook that has style problems
|
49
|
-
And I have installed the lint tool
|
50
|
-
When I run it on the command line with the unimplemented -v option with an argument
|
51
|
-
Then the simple usage text should be displayed along with a non-zero exit code
|
52
|
-
Then the style warning 002 should not be displayed
|
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
|
@@ -1,33 +0,0 @@
|
|
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,FC004 | | FC002,FC004 | failed |
|
21
|
-
| FC002,FC004 | -t style | FC002 | failed |
|
22
|
-
| FC002,FC004 | -t style -f ~any | FC002 | successful |
|
23
|
-
| FC002,FC004 | -f FC005 | FC002,FC004 | successful |
|
24
|
-
| FC002,FC004 | -f FC004 | FC002,FC004 | failed |
|
25
|
-
| FC002,FC004 | --epic-fail FC002 | FC002,FC004 | failed |
|
26
|
-
| FC002,FC005 | -f ~any | FC002,FC005 | successful |
|
27
|
-
| FC002,FC005 | -f any -f ~FC014 | FC002,FC005 | failed |
|
28
|
-
| FC002,FC005 | -f any,~FC014 | FC002,FC005 | failed |
|
29
|
-
| FC002,FC005 | -f ~FC002 | FC002,FC005 | failed |
|
30
|
-
| FC002,FC005 | -f any -f ~FC002 | FC002,FC005 | failed |
|
31
|
-
| FC002 | -f any,~FC002 | FC002 | failed |
|
32
|
-
| FC002,FC005 | -f any,~FC002 | FC002,FC005 | failed |
|
33
|
-
| FC002,FC005 | -f ~FC002 -f ~FC004 | FC002,FC005 | failed |
|
@@ -1,12 +0,0 @@
|
|
1
|
-
Feature: Exclude paths from being linted
|
2
|
-
|
3
|
-
In order to avoid linting some paths that are not really from the cookbook
|
4
|
-
As a developer
|
5
|
-
I want to be able to exclude some files or directories from the passed paths
|
6
|
-
|
7
|
-
Scenario: Exclude a non cookbook directory
|
8
|
-
Given a cookbook that has style problems
|
9
|
-
And unit tests under a top-level test directory
|
10
|
-
When I check the cookbook excluding the test directory
|
11
|
-
Then no warnings will be displayed against the tests
|
12
|
-
And the style warning 002 should be displayed
|
@@ -1,69 +0,0 @@
|
|
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
|
-
| # ~FC006,~FC009 | not be shown |
|
22
|
-
| # ~FC006 ~FC009 | not be shown |
|
23
|
-
| # ~FC006, ~FC009 | not be shown |
|
24
|
-
| # ~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 | FC039 |
|
50
|
-
| # ~FC002,~FC039 | |
|
51
|
-
| # ~FC002 | FC039 |
|
52
|
-
|
53
|
-
Scenario Outline: Ignoring role rules
|
54
|
-
Given a ruby role that triggers FC049 with comment <comment>
|
55
|
-
When I check the role directory
|
56
|
-
Then the role name does not match file name warning 049 should <shown>
|
57
|
-
Examples:
|
58
|
-
| comment | shown |
|
59
|
-
| | be shown |
|
60
|
-
| #~FC049 | not be shown |
|
61
|
-
|
62
|
-
Scenario Outline: Ignoring environment rules
|
63
|
-
Given a ruby environment that triggers FC050 with comment <comment>
|
64
|
-
When I check the environment directory
|
65
|
-
Then the invalid environment name warning 050 should <shown>
|
66
|
-
Examples:
|
67
|
-
| comment | shown |
|
68
|
-
| | be shown |
|
69
|
-
| #~FC050 | not be shown |
|