foodcritic 12.0.1 → 12.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d778c74e1f690101f1d35779fc916bac4b3d4c7f
4
- data.tar.gz: ed2c20f367d97602978301526662285c449c313c
3
+ metadata.gz: d9dd40715774c5adade3569eb138e040cc91c344
4
+ data.tar.gz: 9b3632ea45e7e88c43eb6f90c1e0ec92a959844f
5
5
  SHA512:
6
- metadata.gz: a5778904806b10db9b09c4969a70b849308fc309e8682e81c8f4166c24c364362c4dbcfb5db5d37d9b7d78978de5a9278e70ac06a0f405d71579ec97e749bd5f
7
- data.tar.gz: a283a490bed87be173e490848a6831c5b34973d93efd95b6b85ddf183601a7188de7925b2b87bba3e3401192932d36a6b97163e859012356a9806f7079affd21
6
+ metadata.gz: 7d292e6eb21f89ac2234578ba2857d35d926dfca1f6bd7f06acc3641f0edd4a19a5d9a1c3a7f2aa2020e8539d7732c848742c23355ddafee673b34c0617e1df3
7
+ data.tar.gz: fd145ba3ce3b168efc7311947d550e21cf68048c02e2bab6883ae937609dae43e8e4a415a8f73f06d3ca24d016482822b080b8e9465a83f7c31e6ce744e4b5b9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Foodcritic Changelog:
2
2
 
3
+ ## [12.1.0](https://github.com/Foodcritic/foodcritic/tree/v12.1.0) (2017-10-31)
4
+
5
+ **Implemented enhancements:**
6
+
7
+ - Updated FC094 and FC095 tags from chef15 -> chef14 as the deprecation timeline has been changed
8
+ - Updated FC087 to check for all deprecated Chef::Platform methods
9
+ - Added FC101: Cookbook uses the deprecated deploy resource
10
+ - Added FC102: Cookbook uses the deprecated Chef::DSL::Recipe::FullDSL class
11
+
3
12
  ## [12.0.1](https://github.com/Foodcritic/foodcritic/tree/v12.0.1) (2017-10-19)
4
13
 
5
14
  **Fixed bugs:**
@@ -1,7 +1,7 @@
1
- rule "FC087", "Library maps provider with deprecated Chef::Platform.set" do
1
+ rule "FC087", "Library uses deprecated Chef::Platform methods" do
2
2
  tags %w{chef13 deprecated}
3
3
 
4
4
  library do |ast|
5
- ast.xpath('//const_path_ref/const[@value="Platform"]/..//const[@value="Chef"]/../../../ident[@value="set"]')
5
+ ast.xpath('//const_path_ref/const[@value="Platform"]/..//const[@value="Chef"]/../../../ident[@value="set" or @value="provider_for_resource" or @value="find_provider"]')
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  rule "FC094", "Cookbook uses deprecated filesystem2 ohai plugin data" do
2
- tags %w{deprecated chef15}
2
+ tags %w{deprecated chef14}
3
3
 
4
4
  recipe do |ast|
5
5
  ast.xpath('//aref[vcall/ident/@value="node"]
@@ -1,5 +1,5 @@
1
1
  rule "FC095", "Cookbook uses deprecated cloud_v2 ohai plugin data" do
2
- tags %w{deprecated chef15}
2
+ tags %w{deprecated chef14}
3
3
 
4
4
  recipe do |ast|
5
5
  ast.xpath('//aref[vcall/ident/@value="node"]
@@ -0,0 +1,6 @@
1
+ rule "FC101", "Deprecated deploy resource used" do
2
+ tags %w{chef14 deprecated}
3
+ recipe do |ast|
4
+ find_resources(ast, type: "deploy")
5
+ end
6
+ end
@@ -0,0 +1,11 @@
1
+ rule "FC102", "Deprecated Chef::DSL::Recipe::FullDSL class used" do
2
+ tags %w{chef14 deprecated}
3
+ def full_dsl(ast)
4
+ # include Chef::DSL::Recipe::FullDSL
5
+ ast.xpath('//const_path_ref/const[@value="FullDSL"]/..//const[@value="Recipe"]/..//const[@value="DSL"]/..//const[@value="Chef"]')
6
+ end
7
+ recipe { |ast| full_dsl(ast) }
8
+ library { |ast| full_dsl(ast) }
9
+ resource { |ast| full_dsl(ast) }
10
+
11
+ end
@@ -1,4 +1,4 @@
1
1
  module FoodCritic
2
2
  # The current version of foodcritic
3
- VERSION = "12.0.1"
3
+ VERSION = "12.1.0"
4
4
  end
@@ -9,6 +9,20 @@ describe "FC087" do
9
9
  it { is_expected.to violate_rule }
10
10
  end
11
11
 
12
+ context "with a cookbook with a library that maps providers with Chef::Platform.provider_for_resource" do
13
+ library_file <<-EOF
14
+ provider = Chef::Platform.provider_for_resource(resource, :create)
15
+ EOF
16
+ it { is_expected.to violate_rule }
17
+ end
18
+
19
+ context "with a cookbook with a library that maps providers with Chef::Platform.provider_for_resource" do
20
+ library_file <<-EOF
21
+ provider = Chef::Platform.find_provider("ubuntu", "16.04", resource)
22
+ EOF
23
+ it { is_expected.to violate_rule }
24
+ end
25
+
12
26
  context "with a cookbook with a library that includes Chef::Platform.foo" do
13
27
  library_file <<-EOF
14
28
  module AuditD
@@ -6,7 +6,7 @@ describe "FC100" do
6
6
  it { is_expected.to violate_rule }
7
7
  end
8
8
 
9
- context "with a cookbook with a recipe that includes Chef::Mixin::Languagee" do
9
+ context "with a cookbook with a recipe that includes Chef::Mixin::Language" do
10
10
  recipe_file "include Chef::Mixin::Language"
11
11
  it { is_expected.to violate_rule }
12
12
  end
@@ -0,0 +1,23 @@
1
+ require "spec_helper"
2
+
3
+ describe "FC101" do
4
+ context "with a cookbook with a recipe that includes an deploy resource" do
5
+ recipe_file <<-EOF
6
+ deploy 'private_repo' do
7
+ repo 'git@github.com:acctname/private-repo.git'
8
+ user 'ubuntu'
9
+ deploy_to '/tmp/private_code'
10
+ ssh_wrapper '/tmp/private_code/wrap-ssh4git.sh'
11
+ action :deploy
12
+ end
13
+ EOF
14
+ it { is_expected.to violate_rule }
15
+ end
16
+
17
+ context "with a cookbook with a recipe that doesn't include an deploy resource" do
18
+ recipe_file <<-EOF
19
+ package "foo"
20
+ EOF
21
+ it { is_expected.not_to violate_rule }
22
+ end
23
+ end
@@ -0,0 +1,18 @@
1
+ require "spec_helper"
2
+
3
+ describe "FC102" do
4
+ context "with a cookbook with a custom resource that includes Chef::DSL::Recipe::FullDSL" do
5
+ resource_file "include Chef::DSL::Recipe::FullDSL"
6
+ it { is_expected.to violate_rule }
7
+ end
8
+
9
+ context "with a cookbook with a recipe that includes Chef::DSL::Recipe::FullDSL" do
10
+ recipe_file "include Chef::DSL::Recipe::FullDSL"
11
+ it { is_expected.to violate_rule }
12
+ end
13
+
14
+ context "with a cookbook with a library that includes Chef::DSL::Recipe::FullDSL" do
15
+ library_file "include Chef::DSL::Recipe::FullDSL"
16
+ it { is_expected.to violate_rule }
17
+ end
18
+ end
@@ -7,3 +7,5 @@ FC065: Ensure source_url is set in metadata: ./metadata.rb:1
7
7
  FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
8
8
  FC069: Ensure standardized license defined in metadata: ./metadata.rb:1
9
9
  FC078: Ensure cookbook shared under an OSI-approved open source license: ./metadata.rb:1
10
+ FC087: Library uses deprecated Chef::Platform methods: ./libraries/default.rb:64
11
+ FC098: Deprecated Chef::Mixin::RecipeDefinitionDSLCore mixin used: ./libraries/default.rb:24
@@ -7,4 +7,4 @@ FC066: Ensure chef_version is set in metadata: ./metadata.rb:1
7
7
  FC069: Ensure standardized license defined in metadata: ./metadata.rb:1
8
8
  FC074: LWRP should use DSL to define resource's default action: ./resources/tap.rb:1
9
9
  FC078: Ensure cookbook shared under an OSI-approved open source license: ./metadata.rb:1
10
- FC087: Library maps provider with deprecated Chef::Platform.set: ./libraries/homebrew_package.rb:82
10
+ FC087: Library uses deprecated Chef::Platform methods: ./libraries/homebrew_package.rb:82
@@ -11,3 +11,4 @@ FC074: LWRP should use DSL to define resource's default action: ./resources/logi
11
11
  FC074: LWRP should use DSL to define resource's default action: ./resources/physical_volume.rb:1
12
12
  FC074: LWRP should use DSL to define resource's default action: ./resources/volume_group.rb:1
13
13
  FC078: Ensure cookbook shared under an OSI-approved open source license: ./metadata.rb:1
14
+ FC098: Deprecated Chef::Mixin::RecipeDefinitionDSLCore mixin used: ./resources/volume_group.rb:1
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.0.1
4
+ version: 12.1.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-19 00:00:00.000000000 Z
11
+ date: 2017-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber-core
@@ -334,6 +334,8 @@ files:
334
334
  - lib/foodcritic/rules/fc098.rb
335
335
  - lib/foodcritic/rules/fc099.rb
336
336
  - lib/foodcritic/rules/fc100.rb
337
+ - lib/foodcritic/rules/fc101.rb
338
+ - lib/foodcritic/rules/fc102.rb
337
339
  - lib/foodcritic/template.rb
338
340
  - lib/foodcritic/version.rb
339
341
  - lib/foodcritic/xml.rb
@@ -406,6 +408,8 @@ files:
406
408
  - spec/functional/fc098_spec.rb
407
409
  - spec/functional/fc099_spec.rb
408
410
  - spec/functional/fc100_spec.rb
411
+ - spec/functional/fc101_spec.rb
412
+ - spec/functional/fc102_spec.rb
409
413
  - spec/functional/root_aliases_spec.rb
410
414
  - spec/regression/cookbooks.txt
411
415
  - spec/regression/expected/activemq.txt
@@ -522,5 +526,5 @@ rubyforge_project:
522
526
  rubygems_version: 2.6.13
523
527
  signing_key:
524
528
  specification_version: 4
525
- summary: foodcritic-12.0.1
529
+ summary: foodcritic-12.1.0
526
530
  test_files: []