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,13 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "FC067" do
|
4
|
-
context "with a cookbook with a metadata file that does not specify supports" do
|
5
|
-
metadata_file "name 'my_cookbook'"
|
6
|
-
it { is_expected.to violate_rule }
|
7
|
-
end
|
8
|
-
|
9
|
-
context "with a cookbook with a metadata file that specifies a supported platform (anything)" do
|
10
|
-
metadata_file "supports 'some_os'"
|
11
|
-
it { is_expected.to_not violate_rule }
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "FC068" do
|
4
|
-
context "with a cookbook with a metadata file that does not specify the license" do
|
5
|
-
metadata_file "name 'my_cookbook'"
|
6
|
-
it { is_expected.to violate_rule }
|
7
|
-
end
|
8
|
-
|
9
|
-
context "with a cookbook with a metadata file that specifies a license (anything)" do
|
10
|
-
metadata_file "license 'My Super Cool License'"
|
11
|
-
it { is_expected.to_not violate_rule }
|
12
|
-
end
|
13
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "FC069" do
|
4
|
-
context "with a cookbook with a metadata file that specifies a license generated by knife cookbook create" do
|
5
|
-
metadata_file "license 'Apache 2.0'"
|
6
|
-
it { is_expected.to violate_rule }
|
7
|
-
end
|
8
|
-
|
9
|
-
context "with a cookbook with a metadata file that specifies a license generated by chef generate cookbook" do
|
10
|
-
metadata_file "license 'apache_2'"
|
11
|
-
it { is_expected.to violate_rule }
|
12
|
-
end
|
13
|
-
|
14
|
-
context "with a cookbook with a metadata file that specifies a valid SPDX license" do
|
15
|
-
metadata_file "license 'Apache-2.0'"
|
16
|
-
it { is_expected.to_not violate_rule }
|
17
|
-
end
|
18
|
-
|
19
|
-
context "with a cookbook with a metadata file that specifies ChefDK's non-SPDX all rights reserved string" do
|
20
|
-
metadata_file "license 'All Rights Reserved'"
|
21
|
-
it { is_expected.to_not violate_rule }
|
22
|
-
end
|
23
|
-
|
24
|
-
context "with a cookbook with a metadata file that specifies ChefDK's non-SPDX all rights reserved string with a different casing" do
|
25
|
-
metadata_file "license 'All rights reserved'"
|
26
|
-
it { is_expected.to_not violate_rule }
|
27
|
-
end
|
28
|
-
|
29
|
-
context "with a cookbook with a metadata file that specifies a license with parens" do
|
30
|
-
metadata_file "license('Apache-2.0')"
|
31
|
-
it { is_expected.to_not violate_rule }
|
32
|
-
end
|
33
|
-
|
34
|
-
context "with a cookbook with a metadata file that does not specifiy a license" do
|
35
|
-
metadata_file
|
36
|
-
it { is_expected.to violate_rule }
|
37
|
-
end
|
38
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "FC070" do
|
4
|
-
context "with a cookbook with a metadata file specifying a single valid supports statement" do
|
5
|
-
metadata_file "supports 'ubuntu'"
|
6
|
-
it { is_expected.to_not violate_rule }
|
7
|
-
end
|
8
|
-
|
9
|
-
context "with a cookbook with a metadata file specifying multiple valid supports statements" do
|
10
|
-
metadata_file "%w(ubuntu debian fedora).each do |plat|\nsupports plat\nend"
|
11
|
-
it { is_expected.to_not violate_rule }
|
12
|
-
end
|
13
|
-
|
14
|
-
context "with a cookbook with a metadata file specifying a single invalid supports statement" do
|
15
|
-
metadata_file "supports 'aws'"
|
16
|
-
it { is_expected.to violate_rule }
|
17
|
-
end
|
18
|
-
|
19
|
-
context "with a cookbook with a metadata file specifying multiple invalid supports statements" do
|
20
|
-
metadata_file "%w(aws oel rhel).each do |plat|\nsupports plat\nend"
|
21
|
-
it { is_expected.to violate_rule }
|
22
|
-
end
|
23
|
-
|
24
|
-
context "with a cookbook with a metadata file specifying a mix of valid and invalid supports statements" do
|
25
|
-
metadata_file "%w(aws oracle scientific).each do |plat|\nsupports plat\nend"
|
26
|
-
it { is_expected.to violate_rule }
|
27
|
-
end
|
28
|
-
|
29
|
-
context "with a cookbook with a metadata file specifying a valid supports platform, but uppercase" do
|
30
|
-
metadata_file "supports 'UBUNTU'"
|
31
|
-
it { is_expected.to violate_rule }
|
32
|
-
end
|
33
|
-
|
34
|
-
context "with a cookbook with a metadata file specifying a valid supports platform, but with a version string" do
|
35
|
-
metadata_file "supports 'ubuntu >= 16.04'"
|
36
|
-
it { is_expected.to violate_rule }
|
37
|
-
end
|
38
|
-
|
39
|
-
context "with a cookbook with a metadata file specifying valid platforms from an array with leading whitespace" do
|
40
|
-
metadata_file <<-'EOH'
|
41
|
-
%w(
|
42
|
-
amazon
|
43
|
-
centos
|
44
|
-
debian
|
45
|
-
fedora
|
46
|
-
redhat
|
47
|
-
scientific
|
48
|
-
oracle
|
49
|
-
ubuntu
|
50
|
-
).each do |os|
|
51
|
-
supports os
|
52
|
-
end
|
53
|
-
EOH
|
54
|
-
it { is_expected.to_not violate_rule }
|
55
|
-
end
|
56
|
-
|
57
|
-
context "with a word list and a version constraint" do
|
58
|
-
metadata_file <<-EOH
|
59
|
-
%w{ redhat centos scientific amazon }.each do |os|
|
60
|
-
supports os, ">= 5.0"
|
61
|
-
end
|
62
|
-
EOH
|
63
|
-
it { is_expected.to_not violate_rule }
|
64
|
-
end
|
65
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "FC071" do
|
4
|
-
context "with a cookbook with a LICENSE file" do
|
5
|
-
metadata_file "name 'mycookbook'"
|
6
|
-
file("LICENSE")
|
7
|
-
it { is_expected.not_to violate_rule }
|
8
|
-
end
|
9
|
-
|
10
|
-
context "with a cookbook without a LICENSE file" do
|
11
|
-
metadata_file "name 'mycookbook'"
|
12
|
-
it { is_expected.to violate_rule }
|
13
|
-
end
|
14
|
-
|
15
|
-
context "with a cookbook without a LICENSE file but with license of 'All Rights Reserved'" do
|
16
|
-
metadata_file "license 'All Rights Reserved'"
|
17
|
-
it { is_expected.not_to violate_rule }
|
18
|
-
end
|
19
|
-
|
20
|
-
context "with a cookbook without a LICENSE file but with license of 'all rights reserved'" do
|
21
|
-
metadata_file "license 'all rights reserved'"
|
22
|
-
it { is_expected.not_to violate_rule }
|
23
|
-
end
|
24
|
-
|
25
|
-
context "with a cookbook without a LICENSE file, using a sub folder" do
|
26
|
-
subject { foodcritic_command("--no-progress", "mycookbook/") }
|
27
|
-
file "mycookbook/metadata.rb"
|
28
|
-
it { is_expected.to violate_rule }
|
29
|
-
end
|
30
|
-
|
31
|
-
context "with a cookbook without a LICENSE file but with license of 'All Rights Reserved', using a sub folder" do
|
32
|
-
subject { foodcritic_command("--no-progress", "mycookbook/") }
|
33
|
-
file "mycookbook/metadata.rb", "license 'All Rights Reserved'"
|
34
|
-
it { is_expected.not_to violate_rule }
|
35
|
-
end
|
36
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "FC072" do
|
4
|
-
context "with a cookbook with a metadata file that contains an attribute keyword" do
|
5
|
-
metadata_file "attribute 'something/something',\n display_name: 'something tuneable',\n description: 'This tunes something',\n default: 'none'"
|
6
|
-
it { is_expected.to violate_rule }
|
7
|
-
end
|
8
|
-
|
9
|
-
context "with a cookbook with a metadata file that doesn't contain an attribute keyword" do
|
10
|
-
metadata_file
|
11
|
-
it { is_expected.not_to violate_rule }
|
12
|
-
end
|
13
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "FC073" do
|
4
|
-
context "with an empty cookbook" do
|
5
|
-
metadata_file
|
6
|
-
it { is_expected.to_not violate_rule }
|
7
|
-
end
|
8
|
-
|
9
|
-
context "with only attributes/default.rb" do
|
10
|
-
metadata_file
|
11
|
-
attributes_file
|
12
|
-
it { is_expected.to_not violate_rule }
|
13
|
-
end
|
14
|
-
|
15
|
-
context "with only attributes.rb" do
|
16
|
-
metadata_file
|
17
|
-
file "attributes.rb"
|
18
|
-
it { is_expected.to_not violate_rule }
|
19
|
-
end
|
20
|
-
|
21
|
-
context "with both attributes.rb and attributes/default.rb" do
|
22
|
-
metadata_file
|
23
|
-
file "attributes.rb"
|
24
|
-
attributes_file
|
25
|
-
it { is_expected.to violate_rule.in("attributes/default.rb") }
|
26
|
-
end
|
27
|
-
|
28
|
-
context "with only recipes/default.rb" do
|
29
|
-
metadata_file
|
30
|
-
recipe_file
|
31
|
-
it { is_expected.to_not violate_rule }
|
32
|
-
end
|
33
|
-
|
34
|
-
context "with only recipe.rb" do
|
35
|
-
metadata_file
|
36
|
-
file "recipe.rb"
|
37
|
-
it { is_expected.to_not violate_rule }
|
38
|
-
end
|
39
|
-
|
40
|
-
context "with both recipe.rb and recipes/default.rb" do
|
41
|
-
metadata_file
|
42
|
-
file "recipe.rb"
|
43
|
-
recipe_file
|
44
|
-
it { is_expected.to violate_rule.in("recipes/default.rb") }
|
45
|
-
end
|
46
|
-
|
47
|
-
context "with all four" do
|
48
|
-
metadata_file
|
49
|
-
file "attributes.rb"
|
50
|
-
file "recipe.rb"
|
51
|
-
attributes_file
|
52
|
-
recipe_file
|
53
|
-
it { is_expected.to violate_rule.in("attributes/default.rb") }
|
54
|
-
it { is_expected.to violate_rule.in("recipes/default.rb") }
|
55
|
-
end
|
56
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "FC074" do
|
4
|
-
|
5
|
-
context "with a cookbook with a LWRP that includes a default_action" do
|
6
|
-
resource_file <<-EOH
|
7
|
-
actions :create, :remove
|
8
|
-
default_action :create
|
9
|
-
|
10
|
-
attribute :name, String, name_attribute: true
|
11
|
-
EOH
|
12
|
-
it { is_expected.to_not violate_rule }
|
13
|
-
end
|
14
|
-
|
15
|
-
context "with a cookbook with a LWRP that includes a non-DSL default_action" do
|
16
|
-
resource_file <<-EOH
|
17
|
-
actions :create, :remove,
|
18
|
-
|
19
|
-
def initialize(*args)
|
20
|
-
super
|
21
|
-
@action = :create
|
22
|
-
end
|
23
|
-
|
24
|
-
attribute :name, String, name_attribute: true
|
25
|
-
EOH
|
26
|
-
it { is_expected.to violate_rule }
|
27
|
-
end
|
28
|
-
|
29
|
-
context "with a custom resource" do
|
30
|
-
resource_file <<-EOH
|
31
|
-
property :name, String, name_property: true
|
32
|
-
|
33
|
-
action :create do
|
34
|
-
cookbook_file "/etc/something"
|
35
|
-
end
|
36
|
-
EOH
|
37
|
-
it { is_expected.to_not violate_rule }
|
38
|
-
end
|
39
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "FC075" do
|
4
|
-
|
5
|
-
context "with a cookbook with recipe that uses node.save" do
|
6
|
-
recipe_file "node.save"
|
7
|
-
it { is_expected.to violate_rule }
|
8
|
-
end
|
9
|
-
|
10
|
-
context "with a cookbook with recipe that doesn't use node.save" do
|
11
|
-
recipe_file
|
12
|
-
it { is_expected.not_to violate_rule }
|
13
|
-
end
|
14
|
-
|
15
|
-
context "with a cookbook with recipe that includes node['save']" do
|
16
|
-
recipe_file("node['save']")
|
17
|
-
it { is_expected.not_to violate_rule }
|
18
|
-
end
|
19
|
-
|
20
|
-
context "with a cookbook with a library that uses node.save" do
|
21
|
-
library_file <<-EOH
|
22
|
-
module CookbookHelper
|
23
|
-
def some_method
|
24
|
-
node.save
|
25
|
-
end
|
26
|
-
end
|
27
|
-
EOH
|
28
|
-
it { is_expected.to violate_rule }
|
29
|
-
end
|
30
|
-
|
31
|
-
context "with a cookbook with a custom resource that uses node.save" do
|
32
|
-
resource_file <<-EOH
|
33
|
-
property :name, String, name_property: true
|
34
|
-
|
35
|
-
action :create do
|
36
|
-
node.save
|
37
|
-
end
|
38
|
-
EOH
|
39
|
-
it { is_expected.to violate_rule }
|
40
|
-
end
|
41
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "FC076" do
|
4
|
-
context "with a cookbook with a metadata file that does contain the conflicts keyword" do
|
5
|
-
metadata_file "conflicts 'runit'"
|
6
|
-
it { is_expected.to violate_rule }
|
7
|
-
end
|
8
|
-
|
9
|
-
context "with a cookbook with a metadata file that does not contain the conflicts keyword" do
|
10
|
-
metadata_file
|
11
|
-
it { is_expected.to_not violate_rule }
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "FC077" do
|
4
|
-
context "with a cookbook with a metadata file that does contain the replaces keyword" do
|
5
|
-
metadata_file "replaces 'runit'"
|
6
|
-
it { is_expected.to violate_rule }
|
7
|
-
end
|
8
|
-
|
9
|
-
context "with a cookbook with a metadata file that does not contain the replaces keyword" do
|
10
|
-
metadata_file
|
11
|
-
it { is_expected.to_not violate_rule }
|
12
|
-
end
|
13
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "FC078" do
|
4
|
-
context "with a cookbook with a metadata file that specifies" do
|
5
|
-
context "a license generated by knife cookbook create" do
|
6
|
-
metadata_file "license 'Apache 2.0'"
|
7
|
-
it { is_expected.to violate_rule }
|
8
|
-
end
|
9
|
-
|
10
|
-
context "a license generated by chef generate cookbook" do
|
11
|
-
metadata_file "license 'apache_2'"
|
12
|
-
it { is_expected.to violate_rule }
|
13
|
-
end
|
14
|
-
|
15
|
-
context "a valid OSI-approved open source license in SPDX format" do
|
16
|
-
metadata_file "license 'Apache-2.0'"
|
17
|
-
it { is_expected.to_not violate_rule }
|
18
|
-
end
|
19
|
-
|
20
|
-
context "ChefDK's non-SPDX all rights reserved string" do
|
21
|
-
metadata_file "license 'All Rights Reserved'"
|
22
|
-
it { is_expected.to violate_rule }
|
23
|
-
end
|
24
|
-
|
25
|
-
context "a license with parens" do
|
26
|
-
metadata_file "license('Apache-2.0')"
|
27
|
-
it { is_expected.to_not violate_rule }
|
28
|
-
end
|
29
|
-
|
30
|
-
context "no license" do
|
31
|
-
metadata_file
|
32
|
-
it { is_expected.to violate_rule }
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "FC079" do
|
4
|
-
context "with a cookbook with a recipe that includes an easy_install_package resource" do
|
5
|
-
recipe_file <<-EOF
|
6
|
-
easy_install_package "foo" do
|
7
|
-
action :install
|
8
|
-
end
|
9
|
-
EOF
|
10
|
-
it { is_expected.to violate_rule }
|
11
|
-
end
|
12
|
-
|
13
|
-
context "with a cookbook with a recipe that doesn't include an easy_install_package resource" do
|
14
|
-
recipe_file <<-EOF
|
15
|
-
package "foo" do
|
16
|
-
action :install
|
17
|
-
end
|
18
|
-
EOF
|
19
|
-
it { is_expected.not_to violate_rule }
|
20
|
-
end
|
21
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe "FC080" do
|
4
|
-
context "with a cookbook with a recipe that includes a user resource using supports" do
|
5
|
-
recipe_file <<-EOF
|
6
|
-
user 'betty' do
|
7
|
-
action :create
|
8
|
-
supports({
|
9
|
-
manage_home: true,
|
10
|
-
non_unique: true
|
11
|
-
})
|
12
|
-
end
|
13
|
-
EOF
|
14
|
-
it { is_expected.to violate_rule }
|
15
|
-
end
|
16
|
-
|
17
|
-
context "with a cookbook with a recipe that includes a user resource using supports w/o parens" do
|
18
|
-
recipe_file <<-EOF
|
19
|
-
user 'betty' do
|
20
|
-
action :create
|
21
|
-
supports manage_home: true
|
22
|
-
end
|
23
|
-
EOF
|
24
|
-
it { is_expected.to violate_rule }
|
25
|
-
end
|
26
|
-
|
27
|
-
context "with a cookbook with a recipe that includes a user resource not using supports" do
|
28
|
-
recipe_file <<-EOF
|
29
|
-
user username do
|
30
|
-
shell '/bin/false'
|
31
|
-
home deploy_path
|
32
|
-
system true
|
33
|
-
action :create
|
34
|
-
end
|
35
|
-
EOF
|
36
|
-
it { is_expected.not_to violate_rule }
|
37
|
-
end
|
38
|
-
|
39
|
-
context "with a cookbook with a recipe that includes a resource with supports" do
|
40
|
-
recipe_file <<-EOF
|
41
|
-
service 'foo' do
|
42
|
-
action :start
|
43
|
-
supports :restart
|
44
|
-
EOF
|
45
|
-
it { is_expected.not_to violate_rule }
|
46
|
-
end
|
47
|
-
|
48
|
-
context "with a cookbook with a recipe that includes a user resource and other supports uses" do
|
49
|
-
recipe_file <<-EOF
|
50
|
-
user 'foo' do
|
51
|
-
system true
|
52
|
-
action :create
|
53
|
-
end
|
54
|
-
|
55
|
-
def supports(thing)
|
56
|
-
puts thing
|
57
|
-
end
|
58
|
-
|
59
|
-
supports('something')
|
60
|
-
|
61
|
-
service 'foo' do
|
62
|
-
supports restart: true, status: true
|
63
|
-
action [:enable, :start]
|
64
|
-
end
|
65
|
-
EOF
|
66
|
-
it { is_expected.not_to violate_rule }
|
67
|
-
end
|
68
|
-
end
|