foodcritic 12.1.0 → 12.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/chef_dsl_metadata/chef_13.6.0.json +20328 -0
  4. data/lib/foodcritic/dsl.rb +1 -1
  5. data/lib/foodcritic/linter.rb +1 -1
  6. data/lib/foodcritic/rules/fc075.rb +1 -3
  7. data/lib/foodcritic/rules/fc082.rb +1 -3
  8. data/lib/foodcritic/rules/fc084.rb +1 -4
  9. data/lib/foodcritic/rules/fc085.rb +35 -2
  10. data/lib/foodcritic/rules/fc086.rb +2 -6
  11. data/lib/foodcritic/rules/fc087.rb +0 -1
  12. data/lib/foodcritic/rules/fc088.rb +1 -6
  13. data/lib/foodcritic/rules/fc089.rb +1 -6
  14. data/lib/foodcritic/rules/fc091.rb +0 -1
  15. data/lib/foodcritic/rules/fc092.rb +0 -1
  16. data/lib/foodcritic/rules/fc093.rb +0 -1
  17. data/lib/foodcritic/rules/fc094.rb +0 -1
  18. data/lib/foodcritic/rules/fc095.rb +0 -1
  19. data/lib/foodcritic/rules/fc096.rb +0 -1
  20. data/lib/foodcritic/rules/fc097.rb +1 -5
  21. data/lib/foodcritic/rules/fc098.rb +1 -5
  22. data/lib/foodcritic/rules/fc099.rb +1 -5
  23. data/lib/foodcritic/rules/fc100.rb +1 -5
  24. data/lib/foodcritic/rules/fc102.rb +1 -5
  25. data/lib/foodcritic/rules/fc103.rb +8 -0
  26. data/lib/foodcritic/rules/fc104.rb +18 -0
  27. data/lib/foodcritic/rules/fc105.rb +6 -0
  28. data/lib/foodcritic/rules/fc106.rb +8 -0
  29. data/lib/foodcritic/rules/fc107.rb +6 -0
  30. data/lib/foodcritic/rules/fc108.rb +12 -0
  31. data/lib/foodcritic/rules/fc109.rb +8 -0
  32. data/lib/foodcritic/version.rb +1 -1
  33. data/spec/functional/fc085_spec.rb +23 -4
  34. data/spec/functional/fc086_spec.rb +6 -2
  35. data/spec/functional/fc103_spec.rb +30 -0
  36. data/spec/functional/fc104_spec.rb +45 -0
  37. data/spec/functional/fc105_spec.rb +36 -0
  38. data/spec/functional/fc106_spec.rb +21 -0
  39. data/spec/functional/fc107_spec.rb +22 -0
  40. data/spec/functional/fc108_spec.rb +43 -0
  41. data/spec/functional/fc109_spec.rb +22 -0
  42. data/spec/regression/expected/database.txt +0 -1
  43. data/spec/unit/linter_spec.rb +1 -1
  44. metadata +18 -3
@@ -0,0 +1,45 @@
1
+ require "spec_helper"
2
+
3
+ describe "FC104" do
4
+ context "with a cookbook with a recipe where ruby_block specifies a create action" do
5
+ recipe_file <<-EOF
6
+ ruby_block 'puts' do
7
+ block do
8
+ puts "test test test"
9
+ end
10
+ action :create
11
+ end
12
+ EOF
13
+ it { is_expected.to violate_rule }
14
+ end
15
+
16
+ context "with a cookbook with a recipe where ruby_block specifies a run action" do
17
+ library_file <<-EOF
18
+ ruby_block 'puts' do
19
+ block do
20
+ puts "test test test"
21
+ end
22
+ action :run
23
+ end
24
+ EOF
25
+ it { is_expected.to_not violate_rule }
26
+ end
27
+
28
+ context "with a cookbook with a recipe that notifies :create on a ruby_block" do
29
+ library_file <<-EOF
30
+ file 'foo' do
31
+ notifies :create, 'ruby_block[bar]', :delayed
32
+ end
33
+ EOF
34
+ it { is_expected.to violate_rule }
35
+ end
36
+
37
+ context "with a cookbook with a recipe that notifies :run on a ruby_block" do
38
+ library_file <<-EOF
39
+ file 'foo' do
40
+ notifies :run, 'ruby_block[bar]', :delayed
41
+ end
42
+ EOF
43
+ it { is_expected.to_not violate_rule }
44
+ end
45
+ end
@@ -0,0 +1,36 @@
1
+ require "spec_helper"
2
+
3
+ describe "FC105" do
4
+ context "with a cookbook with a custom resource that includes an erl_call resource" do
5
+ resource_file <<-EOF
6
+ erl_call 'list names' do
7
+ code 'net_adm:names().'
8
+ distributed true
9
+ node_name 'chef@latte'
10
+ end
11
+ EOF
12
+ it { is_expected.to violate_rule }
13
+ end
14
+
15
+ context "with a cookbook with a recipe that includes an erl_call resource" do
16
+ recipe_file <<-EOF
17
+ erl_call 'list names' do
18
+ code 'net_adm:names().'
19
+ distributed true
20
+ node_name 'chef@latte'
21
+ end
22
+ EOF
23
+ it { is_expected.to violate_rule }
24
+ end
25
+
26
+ context "with a cookbook with a library that includes an erl_call resource" do
27
+ library_file <<-EOF
28
+ erl_call 'list names' do
29
+ code 'net_adm:names().'
30
+ distributed true
31
+ node_name 'chef@latte'
32
+ end
33
+ EOF
34
+ it { is_expected.to violate_rule }
35
+ end
36
+ end
@@ -0,0 +1,21 @@
1
+ require "spec_helper"
2
+
3
+ describe "FC106" do
4
+ context "with a cookbook with a recipe that uses hash in a launchd resource" do
5
+ recipe_file <<-EOF
6
+ launchd 'foo' do
7
+ hash {}
8
+ end
9
+ EOF
10
+ it { is_expected.to violate_rule }
11
+ end
12
+
13
+ context "with a cookbook with a recipe that uses plist_hash in a launchd resource" do
14
+ library_file <<-EOF
15
+ launchd 'foo' do
16
+ plist_hash {}
17
+ end
18
+ EOF
19
+ it { is_expected.to_not violate_rule }
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ require "spec_helper"
2
+
3
+ describe "FC107" do
4
+ context "with a cookbook with a recipe that uses uses epic_fail in a resource" do
5
+ recipe_file <<-EOF
6
+ chocolatey_package 'name' do
7
+ epic_fail true
8
+ end
9
+ EOF
10
+ it { is_expected.to violate_rule }
11
+ end
12
+
13
+ context "with a cookbook with a recipe that uses uses ignore_failure in a resource" do
14
+ library_file <<-EOF
15
+ chocolatey_package 'name' do
16
+ action :install
17
+ ignore_failure true
18
+ end
19
+ EOF
20
+ it { is_expected.to_not violate_rule }
21
+ end
22
+ end
@@ -0,0 +1,43 @@
1
+ require "spec_helper"
2
+
3
+ describe "FC108" do
4
+ context "with a cookbook with a custom resource that defines a name property" do
5
+ resource_file <<-EOF
6
+ property :name, String, name_property: true
7
+
8
+ action :create do
9
+ end
10
+ EOF
11
+ it { is_expected.to violate_rule }
12
+ end
13
+
14
+ context "with a cookbook with a custom resource that does not defines a name property" do
15
+ recipe_file <<-EOF
16
+ property :not_name, String, name_property: true
17
+
18
+ action :create do
19
+ end
20
+ EOF
21
+ it { is_expected.to_not violate_rule }
22
+ end
23
+
24
+ context "with a cookbook with a custom resource where a property contains a name variable" do
25
+ recipe_file <<-EOF
26
+ property :home, String, default: lazy { ::File.join('/home/', name) }
27
+
28
+ action :create do
29
+ end
30
+ EOF
31
+ it { is_expected.to_not violate_rule }
32
+ end
33
+
34
+ context "with a cookbook with a custom resource where a property contains a name symbol" do
35
+ recipe_file <<-EOF
36
+ property :foo, Symbol, default: :name
37
+
38
+ action :create do
39
+ end
40
+ EOF
41
+ it { is_expected.to_not violate_rule }
42
+ end
43
+ end
@@ -0,0 +1,22 @@
1
+ require "spec_helper"
2
+
3
+ describe "FC109" do
4
+ context "with a cookbook with a package resource that defines a provider" do
5
+ resource_file <<-EOF
6
+ package 'foo' do
7
+ provider Chef::Provider::Package::Rpm
8
+ action :install
9
+ end
10
+ EOF
11
+ it { is_expected.to violate_rule }
12
+ end
13
+
14
+ context "with a cookbook with a package resource that doesn't define a provider" do
15
+ resource_file <<-EOF
16
+ package 'foo' do
17
+ action :install
18
+ end
19
+ EOF
20
+ it { is_expected.to_not violate_rule }
21
+ end
22
+ end
@@ -19,4 +19,3 @@ FC086: Use databag helper methods to load data bag items: ./recipes/ebs_backup.r
19
19
  FC086: Use databag helper methods to load data bag items: ./recipes/ebs_volume.rb:27
20
20
  FC086: Use databag helper methods to load data bag items: ./recipes/ebs_volume.rb:70
21
21
  FC086: Use databag helper methods to load data bag items: ./recipes/ebs_volume.rb:78
22
- FC086: Use databag helper methods to load data bag items: ./recipes/ebs_volume.rb:94
@@ -12,7 +12,7 @@ describe FoodCritic::Linter do
12
12
 
13
13
  describe "chef version" do
14
14
  it "should be the latest stable version of Chef" do
15
- expect(FoodCritic::Linter::DEFAULT_CHEF_VERSION).to eq "13.5.3"
15
+ expect(FoodCritic::Linter::DEFAULT_CHEF_VERSION).to eq "13.6.0"
16
16
  end
17
17
  end
18
18
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foodcritic
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.1.0
4
+ version: 12.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Crump
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-31 00:00:00.000000000 Z
11
+ date: 2017-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber-core
@@ -181,6 +181,7 @@ files:
181
181
  - chef_dsl_metadata/chef_13.3.42.json
182
182
  - chef_dsl_metadata/chef_13.4.19.json
183
183
  - chef_dsl_metadata/chef_13.5.3.json
184
+ - chef_dsl_metadata/chef_13.6.0.json
184
185
  - features/002_check_string_interpolation.feature
185
186
  - features/004_check_service_resource_used.feature
186
187
  - features/005_check_for_resource_repetition.feature
@@ -336,6 +337,13 @@ files:
336
337
  - lib/foodcritic/rules/fc100.rb
337
338
  - lib/foodcritic/rules/fc101.rb
338
339
  - lib/foodcritic/rules/fc102.rb
340
+ - lib/foodcritic/rules/fc103.rb
341
+ - lib/foodcritic/rules/fc104.rb
342
+ - lib/foodcritic/rules/fc105.rb
343
+ - lib/foodcritic/rules/fc106.rb
344
+ - lib/foodcritic/rules/fc107.rb
345
+ - lib/foodcritic/rules/fc108.rb
346
+ - lib/foodcritic/rules/fc109.rb
339
347
  - lib/foodcritic/template.rb
340
348
  - lib/foodcritic/version.rb
341
349
  - lib/foodcritic/xml.rb
@@ -410,6 +418,13 @@ files:
410
418
  - spec/functional/fc100_spec.rb
411
419
  - spec/functional/fc101_spec.rb
412
420
  - spec/functional/fc102_spec.rb
421
+ - spec/functional/fc103_spec.rb
422
+ - spec/functional/fc104_spec.rb
423
+ - spec/functional/fc105_spec.rb
424
+ - spec/functional/fc106_spec.rb
425
+ - spec/functional/fc107_spec.rb
426
+ - spec/functional/fc108_spec.rb
427
+ - spec/functional/fc109_spec.rb
413
428
  - spec/functional/root_aliases_spec.rb
414
429
  - spec/regression/cookbooks.txt
415
430
  - spec/regression/expected/activemq.txt
@@ -526,5 +541,5 @@ rubyforge_project:
526
541
  rubygems_version: 2.6.13
527
542
  signing_key:
528
543
  specification_version: 4
529
- summary: foodcritic-12.1.0
544
+ summary: foodcritic-12.2.0
530
545
  test_files: []