foodcritic 10.4.0 → 10.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -2
- data/Gemfile +0 -5
- data/Rakefile +0 -16
- data/features/step_definitions/cookbook_steps.rb +0 -228
- data/features/support/command_helpers.rb +1 -0
- data/lib/foodcritic/api.rb +1 -1
- data/lib/foodcritic/rules/fc016.rb +1 -1
- data/lib/foodcritic/rules/fc018.rb +1 -1
- data/lib/foodcritic/rules/fc028.rb +3 -3
- data/lib/foodcritic/rules/fc071.rb +1 -1
- data/lib/foodcritic/version.rb +1 -1
- data/spec/functional/fc013_spec.rb +39 -0
- data/spec/functional/fc016_spec.rb +10 -1
- data/spec/functional/fc028_spec.rb +45 -0
- data/spec/functional/fc070_spec.rb +18 -0
- data/spec/functional/fc071_spec.rb +17 -0
- data/spec/regression/expected/activemq.txt +1 -0
- data/spec/regression/expected/aix.txt +1 -0
- data/spec/regression/expected/apparmor.txt +1 -0
- data/spec/regression/expected/apt.txt +1 -0
- data/spec/regression/expected/ark.txt +1 -0
- data/spec/regression/expected/auditd.txt +1 -0
- data/spec/regression/expected/aws.txt +4 -0
- data/spec/regression/expected/bluepill.txt +1 -0
- data/spec/regression/expected/boost.txt +1 -0
- data/spec/regression/expected/build-essential.txt +1 -0
- data/spec/regression/expected/chef-client.txt +1 -0
- data/spec/regression/expected/chef-ingredient.txt +1 -0
- data/spec/regression/expected/chef-server.txt +1 -0
- data/spec/regression/expected/chef-vault.txt +1 -0
- data/spec/regression/expected/chef.txt +1 -0
- data/spec/regression/expected/chef_handler.txt +1 -0
- data/spec/regression/expected/chef_hostname.txt +1 -0
- data/spec/regression/expected/chef_nginx.txt +1 -0
- data/spec/regression/expected/cron.txt +1 -0
- data/spec/regression/expected/database.txt +2 -0
- data/spec/regression/expected/dmg.txt +1 -0
- data/spec/regression/expected/docker.txt +1 -0
- data/spec/regression/expected/drbd.txt +2 -0
- data/spec/regression/expected/dynect.txt +1 -0
- data/spec/regression/expected/erlang.txt +1 -0
- data/spec/regression/expected/fail2ban.txt +1 -0
- data/spec/regression/expected/firewall.txt +1 -0
- data/spec/regression/expected/gecode.txt +1 -0
- data/spec/regression/expected/gems.txt +1 -0
- data/spec/regression/expected/gunicorn.txt +1 -0
- data/spec/regression/expected/heartbeat.txt +1 -0
- data/spec/regression/expected/homebrew.txt +1 -0
- data/spec/regression/expected/iis.txt +1 -0
- data/spec/regression/expected/iptables.txt +1 -0
- data/spec/regression/expected/jetty.txt +1 -0
- data/spec/regression/expected/jpackage.txt +1 -0
- data/spec/regression/expected/keepalived.txt +1 -0
- data/spec/regression/expected/kickstart.txt +1 -0
- data/spec/regression/expected/libarchive.txt +1 -0
- data/spec/regression/expected/logwatch.txt +1 -0
- data/spec/regression/expected/lvm.txt +1 -0
- data/spec/regression/expected/maradns.txt +1 -0
- data/spec/regression/expected/maven.txt +1 -0
- data/spec/regression/expected/memcached.txt +1 -0
- data/spec/regression/expected/motd-tail.txt +1 -0
- data/spec/regression/expected/mysql.txt +2 -0
- data/spec/regression/expected/ohai.txt +1 -0
- data/spec/regression/expected/openldap.txt +2 -0
- data/spec/regression/expected/openssh.txt +1 -0
- data/spec/regression/expected/openssl.txt +1 -0
- data/spec/regression/expected/partial_search.txt +1 -0
- data/spec/regression/expected/passenger_apache2.txt +1 -0
- data/spec/regression/expected/perl.txt +1 -0
- data/spec/regression/expected/php.txt +1 -0
- data/spec/regression/expected/postfix.txt +1 -0
- data/spec/regression/expected/powershell.txt +1 -0
- data/spec/regression/expected/resolver.txt +1 -0
- data/spec/regression/expected/rsync.txt +1 -0
- data/spec/regression/expected/rsyslog.txt +2 -0
- data/spec/regression/expected/runit.txt +1 -0
- data/spec/regression/expected/smokeping.txt +1 -0
- data/spec/regression/expected/sql_server.txt +2 -0
- data/spec/regression/expected/ssh_known_hosts.txt +1 -0
- data/spec/regression/expected/stompserver.txt +1 -0
- data/spec/regression/expected/subversion.txt +1 -0
- data/spec/regression/expected/sudo.txt +1 -0
- data/spec/regression/expected/tar.txt +1 -0
- data/spec/regression/expected/tftp.txt +1 -0
- data/spec/regression/expected/tomcat.txt +1 -0
- data/spec/regression/expected/transmission.txt +1 -0
- data/spec/regression/expected/ubuntu.txt +1 -0
- data/spec/regression/expected/ufw.txt +1 -0
- data/spec/regression/expected/unicorn.txt +1 -0
- data/spec/regression/expected/users.txt +1 -0
- data/spec/regression/expected/vcruntime.txt +1 -0
- data/spec/regression/expected/vim.txt +1 -0
- data/spec/regression/expected/webpi.txt +1 -0
- data/spec/regression/expected/whitelist-node-attrs.txt +1 -0
- data/spec/regression/expected/windows.txt +1 -0
- data/spec/regression/expected/wix.txt +1 -0
- data/spec/regression/expected/xml.txt +1 -0
- data/spec/regression/expected/yum.txt +1 -0
- data/spec/unit/api_spec.rb +11 -0
- metadata +4 -4
- data/features/013_check_for_hardcoded_tmpdir.feature +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6be21ce54a9247d8ab5fb96fa65056e1b4031a32
|
4
|
+
data.tar.gz: 2de7963ef01d1170af9ca58bf88ba381d057391f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 194e8fb9cdc2e0372cddedd2290c14608a1395c9f7669fc256d4570ed20494ea0d2236b5ce9469a4f0811410a09308c6332e1773c8317366d0840d97156a5601
|
7
|
+
data.tar.gz: bf129cbbab3b85414d432e64ee7c04edcf413158494cf076ab3323c89442df3290221973844e2d4c9eaf7af0f2212e885d58a389b89d523c2d8cbe9103727205
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# Foodcritic Changelog:
|
2
2
|
|
3
|
+
## [10.4.0](https://github.com/acrmp/foodcritic/tree/v10.4.1) (2017-04-17)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/acrmp/foodcritic/compare/v10.4.0...v10.4.1)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Removed the development dependency on github_changelog_generator
|
10
|
+
|
11
|
+
**Fixed bugs:**
|
12
|
+
|
13
|
+
- Fixed running cucumber tests using the cucumber CLI command
|
14
|
+
- Fixed FC016 incorrectly firing on custom resources that have no properties. FC016 will now skip over resources that have any actions as those are custom resources and custom resources don't need to declare a default_action.
|
15
|
+
- Added the missing chef13 tag to FC018
|
16
|
+
- Updated FC028 to detect both `node.platform_family?` in addition to the existing `node.platform?` usage. This rule has also been renamed and tags updated since the use of `node.platform?` is a style issue and not a correctness issue. Both `node.platform?` and `platform?` are acceptable in cookbooks.
|
17
|
+
- Fixed FC071 to not alert for cookbooks where the license is 'all rights reserved' in addition to the existing allowed 'All Rights Reserved' string
|
18
|
+
- Fixed FC071 to detect the LICENSE file if foodcritic is not running in the root of the cookbook
|
19
|
+
- Fixed FC070 to not alert when platform supports is defined through an array of platforms
|
20
|
+
|
3
21
|
## [10.4.0](https://github.com/acrmp/foodcritic/tree/v10.4.0) (2017-04-13)
|
4
22
|
|
5
23
|
[Full Changelog](https://github.com/acrmp/foodcritic/compare/v10.3.1...v10.4.0)
|
@@ -53,7 +71,7 @@
|
|
53
71
|
|
54
72
|
**Implemented enhancements:**
|
55
73
|
|
56
|
-
- Align rake setup better with CLI options to resolve bugs with tags in Rake [
|
74
|
+
- Align rake setup better with CLI options to resolve bugs with tags in Rake [#533](https://github.com/acrmp/foodcritic/pull/533) ([tas50](https://github.com/tas50))
|
57
75
|
|
58
76
|
## [v10.2.1](https://github.com/acrmp/foodcritic/tree/v10.2.1) (2017-03-31)
|
59
77
|
|
@@ -61,7 +79,7 @@
|
|
61
79
|
|
62
80
|
**Implemented enhancements:**
|
63
81
|
|
64
|
-
- Add supermarket tag to FC067 and FC068 [
|
82
|
+
- Add supermarket tag to FC067 and FC068 [#532](https://github.com/acrmp/foodcritic/pull/532) ([tas50](https://github.com/tas50))
|
65
83
|
|
66
84
|
## [v10.2.0](https://github.com/acrmp/foodcritic/tree/v10.2.0) (2017-03-30)
|
67
85
|
|
data/Gemfile
CHANGED
@@ -15,8 +15,3 @@ group :development do
|
|
15
15
|
gem "ronn", "~> 0.7"
|
16
16
|
gem "pry"
|
17
17
|
end
|
18
|
-
|
19
|
-
group :changelog do
|
20
|
-
# This fork has many fixes we want to use. Once this gets merged upstream we can use the gem again
|
21
|
-
gem "github_changelog_generator", git: "https://github.com/tduffield/github-changelog-generator", branch: "adjust-tag-section-mapping"
|
22
|
-
end
|
data/Rakefile
CHANGED
@@ -34,22 +34,6 @@ RuboCop::RakeTask.new do |task|
|
|
34
34
|
task.options << "--display-cop-names"
|
35
35
|
end
|
36
36
|
|
37
|
-
begin
|
38
|
-
require "github_changelog_generator/task"
|
39
|
-
require_relative "../lib/foodcritic/version"
|
40
|
-
|
41
|
-
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
42
|
-
config.header = "# Foodcritic Changelog:"
|
43
|
-
config.future_release = FoodCritic::VERSION
|
44
|
-
config.add_issues_wo_labels = false
|
45
|
-
config.enhancement_labels = "enhancement,Enhancement,Enhancements,New Feature,Feature".split(",")
|
46
|
-
config.bug_labels = "bug,Bug,Improvement,Upstream Bug".split(",")
|
47
|
-
config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog,Exclude From Changelog,Question,Discussion,Tech Cleanup".split(",")
|
48
|
-
end
|
49
|
-
rescue LoadError
|
50
|
-
puts "github_changelog_generator is not available. gem install github_changelog_generator to generate changelogs"
|
51
|
-
end
|
52
|
-
|
53
37
|
desc "Build the manpage"
|
54
38
|
task(:man) do
|
55
39
|
sh "ronn -w --roff man/*.ronn"
|
@@ -190,14 +190,6 @@ Given "a cookbook recipe that refers to an attribute with a bare keyword" do
|
|
190
190
|
}
|
191
191
|
end
|
192
192
|
|
193
|
-
Given /^a cookbook recipe that wraps a platform\-specific resource in a (.*) conditional$/ do |conditional|
|
194
|
-
write_recipe %Q{
|
195
|
-
if #{conditional}
|
196
|
-
Chef::Log.info('We matched the platform')
|
197
|
-
end
|
198
|
-
}
|
199
|
-
end
|
200
|
-
|
201
193
|
Given "a cookbook provider that declares execute resources varying only in the command in separate actions" do
|
202
194
|
write_provider "site", %q{
|
203
195
|
action :start do
|
@@ -253,30 +245,6 @@ Given /^a cookbook recipe that declares a resource called ([^ ]+) with the condi
|
|
253
245
|
}
|
254
246
|
end
|
255
247
|
|
256
|
-
Given /^a cookbook recipe that declares (a resource|multiple resources) nested in a ([a-z_]+) condition with (.*)$/ do |arity, wrapping_condition, condition_attribute|
|
257
|
-
blk = "{ File.exists?('/etc/passwd') }"
|
258
|
-
str = "'test -f /etc/passwd'"
|
259
|
-
conds = wrapping_condition.split("_")
|
260
|
-
write_recipe %Q{
|
261
|
-
#{conds.first} node['foo'] == 'bar'
|
262
|
-
service "apache" do
|
263
|
-
action :enable
|
264
|
-
#{case condition_attribute
|
265
|
-
when /(only_if|not_if) block/ then "#{$1} #{blk}"
|
266
|
-
when /(only_if|not_if) string/ then "#{$1} #{str}"
|
267
|
-
end}
|
268
|
-
end
|
269
|
-
#{if arity.include?('multiple')
|
270
|
-
%q{service "httpd" do
|
271
|
-
action :enable
|
272
|
-
end}
|
273
|
-
end}
|
274
|
-
#{"elsif true\nlog 'bar'" if conds.include? 'elsif'}
|
275
|
-
#{"else\nlog 'foo'" if conds.include? 'else'}
|
276
|
-
end
|
277
|
-
}
|
278
|
-
end
|
279
|
-
|
280
248
|
Given /^a cookbook recipe that declares a resource with a (.*)$/ do |conditional|
|
281
249
|
write_recipe %Q{
|
282
250
|
template "/tmp/foo" do
|
@@ -441,29 +409,6 @@ Given 'a cookbook recipe that has a confusingly named local variable "default"'
|
|
441
409
|
}
|
442
410
|
end
|
443
411
|
|
444
|
-
Given "a cookbook recipe that has a wrapping condition containing a resource with no condition attribute and a Ruby statement" do
|
445
|
-
write_recipe %q{
|
446
|
-
if node['foo'] == 'bar'
|
447
|
-
Chef::Log.info "Enabling apache to start at boot"
|
448
|
-
service "apache" do
|
449
|
-
action :enable
|
450
|
-
end
|
451
|
-
end
|
452
|
-
}
|
453
|
-
end
|
454
|
-
|
455
|
-
Given "a cookbook recipe that has a wrapping condition containing a resource with no condition attribute within a loop" do
|
456
|
-
write_recipe %q{
|
457
|
-
unless node['bar'].include? 'something'
|
458
|
-
bars.each do |bar|
|
459
|
-
service bar['name'] do
|
460
|
-
action :enable
|
461
|
-
end
|
462
|
-
end
|
463
|
-
end
|
464
|
-
}
|
465
|
-
end
|
466
|
-
|
467
412
|
Given /^a cookbook recipe that includes a local recipe(.*)$/ do |diff_name|
|
468
413
|
cookbook = diff_name.empty? ? "example" : "foo"
|
469
414
|
write_recipe %Q{
|
@@ -1003,12 +948,6 @@ Given "a cookbook that does not have defined metadata" do
|
|
1003
948
|
}
|
1004
949
|
end
|
1005
950
|
|
1006
|
-
Given /^a cookbook that downloads a file to (.*)$/ do |path|
|
1007
|
-
recipe_downloads_file({ "/tmp" => :tmp_dir, "/tmp with an expression" => :tmp_dir_expr,
|
1008
|
-
"the Chef file cache" => :chef_file_cache_dir,
|
1009
|
-
"a users home directory" => :home_dir }[path])
|
1010
|
-
end
|
1011
|
-
|
1012
951
|
Given /^a cookbook that has ([^ ]+) problems$/ do |problems|
|
1013
952
|
cookbook_that_matches_rules(
|
1014
953
|
problems.split(",").map do |problem|
|
@@ -1021,10 +960,6 @@ Given /^a cookbook that has ([^ ]+) problems$/ do |problems|
|
|
1021
960
|
)
|
1022
961
|
end
|
1023
962
|
|
1024
|
-
Given "a cookbook that has the default boilerplate metadata generated by knife" do
|
1025
|
-
cookbook_with_maintainer("YOUR_COMPANY_NAME", "YOUR_EMAIL")
|
1026
|
-
end
|
1027
|
-
|
1028
963
|
Given /^a cookbook that matches rules (.*)$/ do |rules|
|
1029
964
|
cookbook_that_matches_rules(rules.split(","))
|
1030
965
|
end
|
@@ -1077,10 +1012,6 @@ Given "a cookbook with a single recipe that accesses multiple node attributes vi
|
|
1077
1012
|
}
|
1078
1013
|
end
|
1079
1014
|
|
1080
|
-
Given "a cookbook with a single recipe that accesses nested node attributes via symbols" do
|
1081
|
-
write_recipe %q{node[:foo][:foo2] = 'bar'}
|
1082
|
-
end
|
1083
|
-
|
1084
1015
|
Given "a cookbook with a single recipe that reads node attributes via symbols and quoted_symbols" do
|
1085
1016
|
write_recipe %q{default[:foo][:'bar-baz']}
|
1086
1017
|
end
|
@@ -1119,18 +1050,6 @@ Given /^a cookbook with a single recipe that explicitly calls a node method( wit
|
|
1119
1050
|
}
|
1120
1051
|
end
|
1121
1052
|
|
1122
|
-
Given "a cookbook with a single recipe that passes node attributes accessed via symbols to a template" do
|
1123
|
-
write_recipe %q{
|
1124
|
-
template "/etc/foo" do
|
1125
|
-
source "foo.erb"
|
1126
|
-
variables({
|
1127
|
-
:port => node[:foo][:port],
|
1128
|
-
:user => node[:foo][:user]
|
1129
|
-
})
|
1130
|
-
end
|
1131
|
-
}.strip
|
1132
|
-
end
|
1133
|
-
|
1134
1053
|
Given "a cookbook with a single recipe that uses a hash value to access a node attribute" do
|
1135
1054
|
write_recipe %q{
|
1136
1055
|
some_hash = {
|
@@ -1173,12 +1092,6 @@ Given /a(nother)? cookbook with a single recipe that (reads|updates|ignores)(nes
|
|
1173
1092
|
|
1174
1093
|
end
|
1175
1094
|
|
1176
|
-
Given "a cookbook with a single recipe that searches based on a node attribute accessed via strings" do
|
1177
|
-
write_recipe %q{
|
1178
|
-
remote = search(:node, "name:#{node['drbd']['remote_host']}")[0]
|
1179
|
-
}.strip
|
1180
|
-
end
|
1181
|
-
|
1182
1095
|
Given "a cookbook with a single recipe which accesses node attributes with symbols on lines 2 and 10" do
|
1183
1096
|
write_recipe %q{
|
1184
1097
|
# Here we access the node attributes via a symbol
|
@@ -1194,10 +1107,6 @@ Given "a cookbook with a single recipe which accesses node attributes with symbo
|
|
1194
1107
|
}
|
1195
1108
|
end
|
1196
1109
|
|
1197
|
-
Given "a cookbook with a single recipe that assigns node attributes accessed via symbols to a local variable" do
|
1198
|
-
write_recipe %q{baz = node[:foo]}
|
1199
|
-
end
|
1200
|
-
|
1201
1110
|
Given /^a cookbook with a single recipe that creates a directory resource with (.*)$/ do |path_type|
|
1202
1111
|
recipe_with_dir_path({ "an interpolated name" => :interpolated_symbol,
|
1203
1112
|
"an interpolated name from a string" => :interpolated_string,
|
@@ -1215,73 +1124,6 @@ Given "a cookbook with a single recipe that logs an interpolated string heredoc"
|
|
1215
1124
|
)
|
1216
1125
|
end
|
1217
1126
|
|
1218
|
-
Given "a cookbook with a single recipe that searches but checks first (alternation) to see if this is server" do
|
1219
|
-
write_recipe %q{
|
1220
|
-
if Chef::Config[:solo] || we_dont_want_to_use_search
|
1221
|
-
# set up stuff from attributes
|
1222
|
-
else
|
1223
|
-
# set up stuff from search
|
1224
|
-
nodes = search(:node, "hostname:[* TO *] AND chef_environment:#{node.chef_environment}")
|
1225
|
-
end
|
1226
|
-
}
|
1227
|
-
end
|
1228
|
-
|
1229
|
-
Given /^a cookbook with a single recipe that searches but checks first( \(string\))? to see if this is server$/ do |str|
|
1230
|
-
write_recipe %Q{
|
1231
|
-
if Chef::Config[#{str ? "'solo'" : ":solo"}]
|
1232
|
-
Chef::Log.warn("This recipe uses search. Chef Solo does not support search.")
|
1233
|
-
else
|
1234
|
-
nodes = search(:node, "hostname:[* TO *] AND chef_environment:#\{node.chef_environment\}")
|
1235
|
-
end
|
1236
|
-
}
|
1237
|
-
end
|
1238
|
-
|
1239
|
-
Given "a cookbook with a single recipe that searches but checks first (ternary) to see if this is server" do
|
1240
|
-
write_recipe %Q{
|
1241
|
-
required_node = Chef::Config[:solo] ? node : search(:node, query).first
|
1242
|
-
}
|
1243
|
-
end
|
1244
|
-
|
1245
|
-
Given /^a cookbook with a single recipe that searches but checks with a negative first to see if this is server$/ do
|
1246
|
-
write_recipe %q{
|
1247
|
-
unless Chef::Config['solo']
|
1248
|
-
nodes = search(:node, "hostname:[* TO *]")
|
1249
|
-
else
|
1250
|
-
Chef::Log.warn("This recipe uses search. Chef Solo does not support search.")
|
1251
|
-
end
|
1252
|
-
}
|
1253
|
-
end
|
1254
|
-
|
1255
|
-
Given /^a cookbook with a single recipe that searches but checks first \(method\) to see if this is server$/ do
|
1256
|
-
write_recipe %Q{
|
1257
|
-
if Chef::Config.solo
|
1258
|
-
Chef::Log.warn("This recipe uses search. Chef Solo does not support search.")
|
1259
|
-
else
|
1260
|
-
nodes = search(:node, "hostname:[* TO *] AND chef_environment:#\{node.chef_environment\}")
|
1261
|
-
end
|
1262
|
-
}
|
1263
|
-
end
|
1264
|
-
|
1265
|
-
Given /^a cookbook with a single recipe that searches but returns first \((oneline|multiline)\) if search is not supported$/ do |format|
|
1266
|
-
if format == "oneline"
|
1267
|
-
write_recipe %q{
|
1268
|
-
return Chef::Log.warn("This recipe uses search. Chef Solo does not support search.") if Chef::Config[:solo]
|
1269
|
-
nodes = search(:node, "hostname:[* TO *] AND chef_environment:#{node.chef_environment}")
|
1270
|
-
}
|
1271
|
-
else
|
1272
|
-
write_recipe %q{
|
1273
|
-
if Chef::Config[:solo]
|
1274
|
-
return Chef::Log.warn("This recipe uses search. Chef Solo does not support search.")
|
1275
|
-
end
|
1276
|
-
nodes = search(:node, "hostname:[* TO *] AND chef_environment:#{node.chef_environment}")
|
1277
|
-
}
|
1278
|
-
end
|
1279
|
-
end
|
1280
|
-
|
1281
|
-
Given "a cookbook with a single recipe that searches without checking if this is server" do
|
1282
|
-
write_recipe %q{nodes = search(:node, "hostname:[* TO *] AND chef_environment:#{node.chef_environment}")}
|
1283
|
-
end
|
1284
|
-
|
1285
1127
|
Given "a cookbook with five recipes" do
|
1286
1128
|
|
1287
1129
|
end
|
@@ -1547,32 +1389,6 @@ Given "access to the man page documentation" do
|
|
1547
1389
|
|
1548
1390
|
end
|
1549
1391
|
|
1550
|
-
Given /^another cookbook that has (an older )?chef-solo-search installed$/ do |older|
|
1551
|
-
if older.nil?
|
1552
|
-
write_library "search", %q{
|
1553
|
-
class Chef
|
1554
|
-
module Mixin
|
1555
|
-
module Language
|
1556
|
-
def search(bag_name, query=nil, sort=nil, start=0, rows=1000, &block)
|
1557
|
-
# https://github.com/edelight/chef-solo-search
|
1558
|
-
end
|
1559
|
-
end
|
1560
|
-
end
|
1561
|
-
end
|
1562
|
-
}
|
1563
|
-
else
|
1564
|
-
write_library "search", %q{
|
1565
|
-
class Chef
|
1566
|
-
class Recipe
|
1567
|
-
def search(bag_name, query=nil, sort=nil, start=0, rows=1000, &block)
|
1568
|
-
# https://github.com/edelight/chef-solo-search
|
1569
|
-
end
|
1570
|
-
end
|
1571
|
-
end
|
1572
|
-
}
|
1573
|
-
end
|
1574
|
-
end
|
1575
|
-
|
1576
1392
|
Given "I have installed the lint tool" do
|
1577
1393
|
|
1578
1394
|
end
|
@@ -1654,15 +1470,6 @@ Given "unit tests under a top-level test directory" do
|
|
1654
1470
|
minitest_spec_attributes
|
1655
1471
|
end
|
1656
1472
|
|
1657
|
-
Given "a recipe that installs a gem with 5 retries" do
|
1658
|
-
write_recipe %q{
|
1659
|
-
gem_package "foo" do
|
1660
|
-
retries 5
|
1661
|
-
action :install
|
1662
|
-
end
|
1663
|
-
}
|
1664
|
-
end
|
1665
|
-
|
1666
1473
|
Given "a recipe that creates a raid array with mdadm specifying layout" do
|
1667
1474
|
write_recipe %q{
|
1668
1475
|
mdadm '/dev/md0' do
|
@@ -1774,10 +1581,6 @@ Given /^the cookbook directory has a \.foodcritic file specifying tags (.*)$/ do
|
|
1774
1581
|
run_lint(["--no-progress", "cookbooks/example"])
|
1775
1582
|
end
|
1776
1583
|
|
1777
|
-
When "I check both cookbooks specified as arguments" do
|
1778
|
-
run_lint(["--no-progress", "cookbooks/another_example", "cookbooks/example"])
|
1779
|
-
end
|
1780
|
-
|
1781
1584
|
When /^I check both cookbooks with the command-line (.*)$/ do |command_line|
|
1782
1585
|
cmds = command_line.split(" ").map do |c|
|
1783
1586
|
if c.end_with?("example")
|
@@ -1992,10 +1795,6 @@ Then /^the lint task will be listed( under the different name)?$/ do |diff_name|
|
|
1992
1795
|
build_tasks.must_include([expected_name, "Lint Chef cookbooks"])
|
1993
1796
|
end
|
1994
1797
|
|
1995
|
-
Then "no error should have occurred" do
|
1996
|
-
assert_no_error_occurred
|
1997
|
-
end
|
1998
|
-
|
1999
1798
|
Then /^(no )?warnings will be displayed against the tests$/ do |no_display|
|
2000
1799
|
if no_display.nil?
|
2001
1800
|
assert_test_warnings
|
@@ -2004,13 +1803,6 @@ Then /^(no )?warnings will be displayed against the tests$/ do |no_display|
|
|
2004
1803
|
end
|
2005
1804
|
end
|
2006
1805
|
|
2007
|
-
Then "the attribute consistency warning 019 should warn on lines 2 and 10 in that order" do
|
2008
|
-
expected_warnings = [2, 10].map do |line|
|
2009
|
-
"FC019: Access node attributes in a consistent manner: cookbooks/example/recipes/default.rb:#{line}"
|
2010
|
-
end
|
2011
|
-
expect_output(expected_warnings.join("\n"))
|
2012
|
-
end
|
2013
|
-
|
2014
1806
|
Then "the attribute consistency warning 019 should be displayed for the recipe" do
|
2015
1807
|
expect_warning("FC019", :line => 2)
|
2016
1808
|
end
|
@@ -2097,10 +1889,6 @@ Then /^the warning (\d+) should be (valid|invalid)$/ do |code, valid|
|
|
2097
1889
|
valid == "valid" ? expect_no_warning(code) : expect_warning(code)
|
2098
1890
|
end
|
2099
1891
|
|
2100
|
-
Then /^the incorrect platform usage warning 028 should be (not )?shown$/ do |should_not|
|
2101
|
-
expect_warning("FC028", :line => nil, :expect_warning => should_not.nil?)
|
2102
|
-
end
|
2103
|
-
|
2104
1892
|
Then /^the line number and line of code that triggered the warning(s)? should be displayed$/ do |multiple|
|
2105
1893
|
if multiple.nil?
|
2106
1894
|
expect_line_shown 1, "log node[:foo]"
|
@@ -2221,22 +2009,6 @@ Given(/^a cookbook with an? (.*) file with an interpolated name$/) do |file_type
|
|
2221
2009
|
write_library "lib", content if file_type == "library"
|
2222
2010
|
end
|
2223
2011
|
|
2224
|
-
Then /^the metadata missing maintainer warning 055 should be (shown|not shown) against the metadata file$/ do |show_warning|
|
2225
|
-
expect_warning("FC055", :file => "metadata.rb", :expect_warning => show_warning == "shown")
|
2226
|
-
end
|
2227
|
-
|
2228
|
-
Then /^the metadata missing maintainer email warning 056 should be (shown|not shown) against the metadata file$/ do |show_warning|
|
2229
|
-
expect_warning("FC056", :file => "metadata.rb", :expect_warning => show_warning == "shown")
|
2230
|
-
end
|
2231
|
-
|
2232
|
-
Then /^the metadata using suggests warning 052 should be (shown|not shown) against the metadata file$/ do |show_warning|
|
2233
|
-
expect_warning("FC052", :file => "metadata.rb", :line => 2, :expect_warning => show_warning == "shown")
|
2234
|
-
end
|
2235
|
-
|
2236
|
-
Then /^the metadata using recommends warning 053 should be (shown|not shown) against the metadata file$/ do |show_warning|
|
2237
|
-
expect_warning("FC053", :file => "metadata.rb", :line => 2, :expect_warning => show_warning == "shown")
|
2238
|
-
end
|
2239
|
-
|
2240
2012
|
Given /^a cookbook that contains a LWRP provider (with|without) use_inline_resources( and uses def action_create)?$/ do |with_use_inline_resources, uses_def|
|
2241
2013
|
write_resource("site", %q{
|
2242
2014
|
actions :create
|
data/lib/foodcritic/api.rb
CHANGED
@@ -393,7 +393,7 @@ module FoodCritic
|
|
393
393
|
platforms.map do |platform|
|
394
394
|
versions = platform.xpath('ancestor::args_add[position() > 1]/
|
395
395
|
string_literal/descendant::tstring_content/@value').map { |v| v.to_s }
|
396
|
-
{ platform: platform["value"], versions: versions }
|
396
|
+
{ platform: platform["value"].lstrip, versions: versions }
|
397
397
|
end.sort { |a, b| a[:platform] <=> b[:platform] }
|
398
398
|
end
|
399
399
|
|
@@ -2,7 +2,7 @@ rule "FC016", "LWRP does not declare a default action" do
|
|
2
2
|
tags %w{correctness lwrp}
|
3
3
|
resource do |ast, filename|
|
4
4
|
# See if we're in a custom resource not an LWRP. Only LWRPs need the default_action
|
5
|
-
next if ast.xpath("//ident/@value='
|
5
|
+
next if ast.xpath("//ident/@value='action'")
|
6
6
|
unless ["//ident/@value='default_action'",
|
7
7
|
"//def/bodystmt/descendant::assign/
|
8
8
|
var_field/ivar/@value='@action'"].any? { |expr| ast.xpath(expr) }
|