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
data/Rakefile
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require "bundler/setup"
|
2
|
-
require "mixlib/shellout"
|
3
|
-
|
4
|
-
require "bundler/gem_tasks"
|
5
|
-
|
6
|
-
require "rspec/core/rake_task"
|
7
|
-
RSpec::Core::RakeTask.new(:spec, :tag) do |t, args|
|
8
|
-
t.rspec_opts = [].tap do |a|
|
9
|
-
a << "--color"
|
10
|
-
a << "--format #{ENV['CI'] ? 'documentation' : 'Fuubar'}"
|
11
|
-
a << "--backtrace" if ENV["DEBUG"]
|
12
|
-
a << "--seed #{ENV['SEED']}" if ENV["SEED"]
|
13
|
-
a << "--tag ~regression" unless ENV["CI"] || args[:tag].to_s =~ /regression/
|
14
|
-
a << "--tag #{args[:tag]}" if args[:tag]
|
15
|
-
end.join(" ")
|
16
|
-
end
|
17
|
-
|
18
|
-
require "cucumber"
|
19
|
-
require "cucumber/rake/task"
|
20
|
-
Cucumber::Rake::Task.new(:features) do |t|
|
21
|
-
t.cucumber_opts = %w{--strict}
|
22
|
-
t.cucumber_opts += %w{-f progress} unless ENV["CI"]
|
23
|
-
unless ENV.key?("FC_FORK_PROCESS") && ENV["FC_FORK_PROCESS"] == "true"
|
24
|
-
t.cucumber_opts += ["-t", "~@build"]
|
25
|
-
t.cucumber_opts += ["-t", "~@context"]
|
26
|
-
end
|
27
|
-
t.cucumber_opts += ["features"]
|
28
|
-
end
|
29
|
-
|
30
|
-
require "chefstyle"
|
31
|
-
require "rubocop/rake_task"
|
32
|
-
desc "Run Chefstyle (rubocop)"
|
33
|
-
RuboCop::RakeTask.new do |task|
|
34
|
-
task.options << "--display-cop-names"
|
35
|
-
end
|
36
|
-
|
37
|
-
desc "Build the manpage"
|
38
|
-
task(:man) do
|
39
|
-
sh "ronn -w --roff man/*.ronn"
|
40
|
-
end
|
41
|
-
|
42
|
-
task default: [:man, :test, :rubocop]
|
43
|
-
|
44
|
-
desc "Run all tests"
|
45
|
-
task test: [:spec, :features]
|
46
|
-
|
47
|
-
desc "Regenerate regression test data"
|
48
|
-
task :regen_regression do
|
49
|
-
in_path = File.expand_path("../spec/regression/cookbooks.txt", __FILE__)
|
50
|
-
cookbooks = IO.readlines(in_path)
|
51
|
-
cookbooks.each_with_index do |line, i|
|
52
|
-
name, ref = line.strip.split(":")
|
53
|
-
puts "Regenerating output for #{name} (#{i + 1}/#{cookbooks.size})"
|
54
|
-
Dir.mktmpdir do |temp|
|
55
|
-
clone_cmd = Mixlib::ShellOut.new("git", "clone", "https://github.com/chef-cookbooks/#{name}.git", ".", cwd: temp)
|
56
|
-
clone_cmd.run_command
|
57
|
-
clone_cmd.error!
|
58
|
-
checkout_cmd = Mixlib::ShellOut.new("git", "checkout", ref, cwd: temp)
|
59
|
-
checkout_cmd.run_command
|
60
|
-
checkout_cmd.error!
|
61
|
-
fc_cmd = Mixlib::ShellOut.new("#{File.expand_path("../bin/foodcritic", __FILE__)} --tags any --no-progress .", cwd: temp)
|
62
|
-
fc_cmd.run_command
|
63
|
-
out_path = File.expand_path("../spec/regression/expected/#{name}.txt", __FILE__)
|
64
|
-
IO.write(out_path, fc_cmd.stdout)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
desc "Run one regression test (or all of them)"
|
70
|
-
task :regression, [:cookbook] do |t, args|
|
71
|
-
tag = args[:cookbook] ? "regression_#{args[:cookbook]}" : "regression"
|
72
|
-
Rake::Task["spec"].invoke(tag)
|
73
|
-
end
|
@@ -1,50 +0,0 @@
|
|
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
|
46
|
-
|
47
|
-
Scenario: String interpolation in heredoc
|
48
|
-
Given a cookbook with a single recipe that logs an interpolated string heredoc
|
49
|
-
When I check the cookbook
|
50
|
-
Then the string interpolation warning 002 should not be displayed
|
@@ -1,64 +0,0 @@
|
|
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
|
@@ -1,36 +0,0 @@
|
|
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
|
-
| file | ary[1] | valid |
|
29
|
-
| template | 00400 | valid |
|
30
|
-
| template | 400 | invalid |
|
31
|
-
| template | "400" | valid |
|
32
|
-
|
33
|
-
Scenario: Unspecified mode
|
34
|
-
Given a file resource declared without a mode
|
35
|
-
When I check the cookbook
|
36
|
-
Then the warning 006 should not be displayed
|
@@ -1,55 +0,0 @@
|
|
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
|
-
|
32
|
-
Scenario: Resource declared with only a name attribute
|
33
|
-
Given a recipe that declares a resource with only a name attribute
|
34
|
-
When I check the cookbook
|
35
|
-
Then the unrecognised attribute warning 009 should not be displayed
|
36
|
-
|
37
|
-
Scenario: Unrecognised attribute on recipe with multiple resources of the same type
|
38
|
-
Given a recipe that declares multiple resources of the same type of which one has a bad attribute
|
39
|
-
When I check the cookbook
|
40
|
-
Then the unrecognised attribute warning 009 should be displayed against the correct resource
|
41
|
-
|
42
|
-
Scenario: Resource with conditional attributes
|
43
|
-
Given a recipe that declares a resource with recognised attributes and a conditional execution ruby block
|
44
|
-
When I check the cookbook
|
45
|
-
Then the unrecognised attribute warning 009 should not be displayed
|
46
|
-
|
47
|
-
Scenario: Resource with nested block
|
48
|
-
Given a recipe that declares a resource with recognised attributes and a nested block
|
49
|
-
When I check the cookbook
|
50
|
-
Then the unrecognised attribute warning 009 should not be displayed
|
51
|
-
|
52
|
-
Scenario: Resource with attribute method call
|
53
|
-
Given a recipe that declares a resource with an attribute value set to the result of a method call
|
54
|
-
When I check the cookbook
|
55
|
-
Then the unrecognised attribute warning 009 should not be displayed
|
@@ -1,30 +0,0 @@
|
|
1
|
-
Feature: Check for overly long ruby blocks
|
2
|
-
|
3
|
-
In order to keep my cookbooks readable
|
4
|
-
As a developer
|
5
|
-
I want to identify if ruby blocks in my recipes are too long and should be extracted to libraries
|
6
|
-
|
7
|
-
Scenario: No ruby blocks
|
8
|
-
Given a cookbook that contains no ruby blocks
|
9
|
-
When I check the cookbook
|
10
|
-
Then the long ruby block warning 014 should not be displayed
|
11
|
-
|
12
|
-
Scenario: Short ruby block
|
13
|
-
Given a cookbook that contains a short ruby block
|
14
|
-
When I check the cookbook
|
15
|
-
Then the long ruby block warning 014 should not be displayed
|
16
|
-
|
17
|
-
Scenario: Long ruby block
|
18
|
-
Given a cookbook that contains a long ruby block
|
19
|
-
When I check the cookbook
|
20
|
-
Then the long ruby block warning 014 should be displayed
|
21
|
-
|
22
|
-
Scenario: Multiple ruby blocks
|
23
|
-
Given a recipe that contains both long and short ruby blocks
|
24
|
-
When I check the cookbook
|
25
|
-
Then the long ruby block warning 014 should be displayed against the long block only
|
26
|
-
|
27
|
-
Scenario: Missing block attribute
|
28
|
-
Given a recipe that contains a ruby block without a block attribute
|
29
|
-
When I check the cookbook
|
30
|
-
Then the long ruby block warning 014 should not be displayed
|
@@ -1,25 +0,0 @@
|
|
1
|
-
Feature: Check for use of deprecated LWRP notification syntax
|
2
|
-
|
3
|
-
In order to ensure LWRP notifications continue to work
|
4
|
-
As a developer
|
5
|
-
I want to identify when a LWRP notification uses the deprecated syntax
|
6
|
-
|
7
|
-
Scenario: LWRP with no notifications
|
8
|
-
Given a cookbook that contains a LWRP that does not trigger notifications
|
9
|
-
When I check the cookbook
|
10
|
-
Then the LWRP uses deprecated notification syntax warning 018 should not be displayed against the provider file
|
11
|
-
|
12
|
-
Scenario: LWRP with deprecated notification syntax
|
13
|
-
Given a cookbook that contains a LWRP that uses the deprecated notification syntax
|
14
|
-
When I check the cookbook
|
15
|
-
Then the LWRP uses deprecated notification syntax warning 018 should be displayed against the provider file
|
16
|
-
|
17
|
-
Scenario: LWRP with deprecated notification syntax (class variable)
|
18
|
-
Given a cookbook that contains a LWRP that uses the deprecated notification syntax with a class variable
|
19
|
-
When I check the cookbook
|
20
|
-
Then the LWRP uses deprecated notification syntax warning 018 should be displayed against the provider file
|
21
|
-
|
22
|
-
Scenario: LWRP with current notification syntax
|
23
|
-
Given a cookbook that contains a LWRP that uses the current notification syntax
|
24
|
-
When I check the cookbook
|
25
|
-
Then the LWRP uses deprecated notification syntax warning 018 should not be displayed against the provider file
|
@@ -1,108 +0,0 @@
|
|
1
|
-
Feature: Check for consistency in node access
|
2
|
-
|
3
|
-
In order to be consistent in the way I access node attributes
|
4
|
-
As a developer
|
5
|
-
I want to identify if the same cookbook uses varying approaches to accessing node attributes
|
6
|
-
|
7
|
-
Scenario Outline: Retrieve node attributes
|
8
|
-
Given a cookbook with a single recipe that <accesses><nested> node attributes via <read_access_type>
|
9
|
-
When I check the cookbook
|
10
|
-
Then the attribute consistency warning 019 should be <show_warning>
|
11
|
-
|
12
|
-
Examples:
|
13
|
-
| accesses | read_access_type | nested | show_warning |
|
14
|
-
| ignores | none | | not shown |
|
15
|
-
| reads | symbols | | not shown |
|
16
|
-
| reads | strings | | not shown |
|
17
|
-
| reads | vivified | | not shown |
|
18
|
-
| reads | strings,symbols | | shown |
|
19
|
-
| reads | strings,vivified | | shown |
|
20
|
-
| reads | symbols,strings | nested | shown |
|
21
|
-
| reads | symbols,vivified | | shown |
|
22
|
-
| reads | vivified,strings | | shown |
|
23
|
-
| reads | vivified,symbols | | shown |
|
24
|
-
| updates | symbols | | not shown |
|
25
|
-
| updates | strings | nested | not shown |
|
26
|
-
| updates | vivified | | not shown |
|
27
|
-
| updates | strings,symbols | | shown |
|
28
|
-
| updates | strings,vivified | nested | shown |
|
29
|
-
| updates | symbols,strings | | shown |
|
30
|
-
| updates | symbols,vivified | | shown |
|
31
|
-
| updates | vivified,strings | | shown |
|
32
|
-
| updates | vivified,symbols | | shown |
|
33
|
-
|
34
|
-
Scenario: Quoted symbols
|
35
|
-
Given a cookbook with a single recipe that reads node attributes via symbols and quoted_symbols
|
36
|
-
When I check the cookbook
|
37
|
-
Then the attribute consistency warning 019 should be not shown
|
38
|
-
|
39
|
-
Scenario: Multiple file matches
|
40
|
-
Given a cookbook with five recipes
|
41
|
-
And three of the recipes read node attributes via strings
|
42
|
-
And two of the recipes read node attributes via symbols
|
43
|
-
When I check the cookbook
|
44
|
-
Then the attribute consistency warning 019 should be shown for both of the recipes that use symbols
|
45
|
-
|
46
|
-
Scenario Outline: Ignore node built-in methods
|
47
|
-
Given a cookbook with a single recipe that <accesses> node attributes via <read_access_type> and calls node.<method>
|
48
|
-
When I check the cookbook
|
49
|
-
Then the attribute consistency warning 019 should be <show_warning>
|
50
|
-
|
51
|
-
Examples:
|
52
|
-
| accesses | read_access_type | method | show_warning |
|
53
|
-
| reads | strings | platform? | not shown |
|
54
|
-
| reads | symbols | run_list | not shown |
|
55
|
-
| reads | symbols | run_state | not shown |
|
56
|
-
| reads | strings | run_state | not shown |
|
57
|
-
| reads | strings | set | not shown |
|
58
|
-
| reads | strings,symbols | set | shown |
|
59
|
-
|
60
|
-
Scenario Outline: Ignore method calls on node values
|
61
|
-
Given a cookbook with a single recipe that <accesses> node attributes via <read_access_type> with <expression>
|
62
|
-
When I check the cookbook
|
63
|
-
Then the attribute consistency warning 019 should be <show_warning>
|
64
|
-
|
65
|
-
Examples:
|
66
|
-
| accesses | read_access_type | expression | show_warning |
|
67
|
-
| reads | symbols | node.platform_version | shown |
|
68
|
-
| reads | symbols | node.run_list | not shown |
|
69
|
-
| reads | symbols | node[:foo].chomp | not shown |
|
70
|
-
| reads | symbols | node[:foo][:bar].split(' ').first | not shown |
|
71
|
-
| reads | symbols | node[:foo].bar | not shown |
|
72
|
-
| reads | symbols | foo = node[:foo].bar | not shown |
|
73
|
-
| reads | symbols | node[:foo].each{\|f\| puts f} | not shown |
|
74
|
-
| updates | symbols | node[:foo].strip | not shown |
|
75
|
-
| updates | strings | node[:foo].strip | shown |
|
76
|
-
| updates | strings | foo = node[:foo].strip | shown |
|
77
|
-
| updates | symbols | node['foo'].strip | shown |
|
78
|
-
|
79
|
-
Scenario: Ignore method calls on patched node values
|
80
|
-
Given a cookbook with a single recipe that calls a patched node method
|
81
|
-
When I check the cookbook
|
82
|
-
Then the attribute consistency warning 019 should be not shown
|
83
|
-
|
84
|
-
Scenario: Ignore explicit method calls (zero-arg)
|
85
|
-
Given a cookbook with a single recipe that explicitly calls a node method
|
86
|
-
When I check the cookbook
|
87
|
-
Then the attribute consistency warning 019 should be not shown
|
88
|
-
|
89
|
-
Scenario: Ignore explicit method calls (multiple arguments)
|
90
|
-
Given a cookbook with a single recipe that explicitly calls a node method with multiple arguments
|
91
|
-
When I check the cookbook
|
92
|
-
Then the attribute consistency warning 019 should be not shown
|
93
|
-
|
94
|
-
Scenario: User hashes
|
95
|
-
Given a cookbook with a single recipe that uses a hash value to access a node attribute
|
96
|
-
When I check the cookbook
|
97
|
-
Then the attribute consistency warning 019 should be not shown
|
98
|
-
|
99
|
-
Scenario: Interpolated access
|
100
|
-
Given a cookbook with a single recipe that mixes node access types in an interpolated value
|
101
|
-
When I check the cookbook
|
102
|
-
Then the attribute consistency warning 019 should be shown
|
103
|
-
|
104
|
-
Scenario: Two cookbooks with differing approaches
|
105
|
-
Given a cookbook with a single recipe that reads node attributes via strings only
|
106
|
-
And another cookbook with a single recipe that reads node attributes via symbols only
|
107
|
-
When I check the cookbook tree
|
108
|
-
Then the attribute consistency warning 019 should not be displayed
|