foodcritic 12.2.0 → 12.2.1

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: e0213d1fd217d9749f2715447be5c129bbc79f3b
4
- data.tar.gz: c162aa6f73f436caa900fa61ffadc8cc85236df7
3
+ metadata.gz: 8d7566bbb8e6c6bf3c8f3410e1a2bfc884becee4
4
+ data.tar.gz: f0e32659516e8f0f191fe0790626b3a6e073694f
5
5
  SHA512:
6
- metadata.gz: 689328b2fe137925679a6954e06068e9f850d19299fc4cfa6647fea7769609474227c1f83000aedea8677aabbf44b1dccd0aa5542de817aec81f37c925ffbfb5
7
- data.tar.gz: 8c3f67dbff1a1adf6ab13bd56b4d8b89788c9aa15106c6169d531e890438a4d6441a261ac03b3e4dbac72f96344978f5c58cbec8d97702117469020fe7f5afed
6
+ metadata.gz: da2b94c491d43fefed96decc3e375652d478856fef5ce9a770aa935524ba6f2c98ff28a5e2324de20f2e260241be36a3cba0a7264fa465d874a008b54b4b2c0a
7
+ data.tar.gz: 2da6b12cba8bc43443d6ca5cd888e1d433f595eacd9aa7d1824c0b7eceb2eed010365e5d59058755d07682a37ea6c921a531065395178ebb050e8a42ee474d7a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Foodcritic Changelog:
2
2
 
3
+ ## [12.2.1](https://github.com/Foodcritic/foodcritic/tree/v12.2.0) (2017-11-14)
4
+
5
+ **Fixed bugs:**
6
+
7
+ - Fixed FC104 alerting for any resource with a :create action instead of just ruby_block resources
8
+
3
9
  ## [12.2.0](https://github.com/Foodcritic/foodcritic/tree/v12.2.0) (2017-11-14)
4
10
 
5
11
  **Implemented enhancements:**
@@ -4,9 +4,7 @@ rule "FC104", "Use the :run action in ruby_block instead of :create" do
4
4
  matches = []
5
5
  find_resources(ast).each do |resource|
6
6
  # if it's a ruby_block check for the :create action
7
- if ast.xpath('//method_add_block[command/ident[@value="ruby_block"]]')
8
- matches << resource if resource_attribute(resource, "action") == :create
9
- end
7
+ matches << resource if resource_attribute(resource, "action") == :create && resource_type(resource) == "ruby_block"
10
8
 
11
9
  # no matter what check notification
12
10
  notifications(resource).any? do |notification|
@@ -1,4 +1,4 @@
1
1
  module FoodCritic
2
2
  # The current version of foodcritic
3
- VERSION = "12.2.0"
3
+ VERSION = "12.2.1"
4
4
  end
@@ -14,7 +14,7 @@ describe "FC104" do
14
14
  end
15
15
 
16
16
  context "with a cookbook with a recipe where ruby_block specifies a run action" do
17
- library_file <<-EOF
17
+ recipe_file <<-EOF
18
18
  ruby_block 'puts' do
19
19
  block do
20
20
  puts "test test test"
@@ -26,7 +26,7 @@ describe "FC104" do
26
26
  end
27
27
 
28
28
  context "with a cookbook with a recipe that notifies :create on a ruby_block" do
29
- library_file <<-EOF
29
+ recipe_file <<-EOF
30
30
  file 'foo' do
31
31
  notifies :create, 'ruby_block[bar]', :delayed
32
32
  end
@@ -35,11 +35,20 @@ describe "FC104" do
35
35
  end
36
36
 
37
37
  context "with a cookbook with a recipe that notifies :run on a ruby_block" do
38
- library_file <<-EOF
38
+ recipe_file <<-EOF
39
39
  file 'foo' do
40
40
  notifies :run, 'ruby_block[bar]', :delayed
41
41
  end
42
42
  EOF
43
43
  it { is_expected.to_not violate_rule }
44
44
  end
45
+
46
+ context "with a cookbook with a recipe that has a non-ruby_block resource with :create action" do
47
+ recipe_file <<-EOF
48
+ directory 'foo' do
49
+ action :create
50
+ end
51
+ EOF
52
+ it { is_expected.to_not violate_rule }
53
+ end
45
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foodcritic
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.2.0
4
+ version: 12.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Crump
@@ -541,5 +541,5 @@ rubyforge_project:
541
541
  rubygems_version: 2.6.13
542
542
  signing_key:
543
543
  specification_version: 4
544
- summary: foodcritic-12.2.0
544
+ summary: foodcritic-12.2.1
545
545
  test_files: []