foodcritic 10.1.0 → 10.1.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 +7 -1
- data/features/016_check_for_no_lwrp_default_action.feature +5 -0
- data/features/step_definitions/cookbook_steps.rb +4 -0
- data/features/support/cookbook_helpers.rb +21 -0
- data/lib/foodcritic/api.rb +1 -1
- data/lib/foodcritic/rules/fc016.rb +2 -0
- data/lib/foodcritic/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf1400039591c18cb681dc2add6b181ea08cd506
|
4
|
+
data.tar.gz: a54e351dc350f646a429ec9a266c4d67f09979d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fc6031eb6d2c0a25d59871f9412decb490e455a2e0be5617c6473ab7c32a0642005023da4918cb55c03d02399b413bf8327ba68528dc9a88c908292f270e728
|
7
|
+
data.tar.gz: 9d9f373826b4e3996dfd41a7a0227210bc8ab601668a8eef96eeda39bac179752b59bcc8e7fae3dbe9d956c385707138593573ec3026cfa416400899fac91e3a
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
# Foodcritic Changelog:
|
2
2
|
|
3
|
-
## [10.1.
|
3
|
+
## [10.1.1](https://github.com/acrmp/foodcritic/tree/v10.1.1) (2017-03-29)
|
4
|
+
[Full Changelog](https://github.com/acrmp/foodcritic/compare/v10.1.0...v10.1.1)
|
4
5
|
|
6
|
+
**Fixed bugs:**
|
7
|
+
|
8
|
+
- Fix FC016 triggering on custom resources [\#525](https://github.com/acrmp/foodcritic/pull/525) ([tas50](https://github.com/tas50))
|
9
|
+
|
10
|
+
## [v10.1.0](https://github.com/acrmp/foodcritic/tree/v10.1.0) (2017-03-29)
|
5
11
|
[Full Changelog](https://github.com/acrmp/foodcritic/compare/v10.0.0...v10.1.0)
|
6
12
|
|
7
13
|
**Implemented enhancements:**
|
@@ -18,3 +18,8 @@ Feature: Check for no LWRP default action
|
|
18
18
|
Given a cookbook that contains a LWRP with a default action defined via a constructor
|
19
19
|
When I check the cookbook
|
20
20
|
Then the LWRP has no default action warning 016 should not be displayed against the resource file
|
21
|
+
|
22
|
+
Scenario: Custom resource with no default action
|
23
|
+
Given a cookbook that contains a custom resource with no default action
|
24
|
+
When I check the cookbook
|
25
|
+
Then the LWRP has no default action warning 016 should not be displayed against the resource file
|
@@ -984,6 +984,10 @@ Given /^a cookbook that contains a LWRP with (no|a) default action( defined via
|
|
984
984
|
:notifies => :does_notify })
|
985
985
|
end
|
986
986
|
|
987
|
+
Given "a cookbook that contains a custom resource with no default action" do
|
988
|
+
cookbook_with_custom_resource
|
989
|
+
end
|
990
|
+
|
987
991
|
Given "a cookbook that contains no ruby blocks" do
|
988
992
|
write_recipe %q{
|
989
993
|
package "tar" do
|
@@ -94,6 +94,27 @@ module FoodCritic
|
|
94
94
|
}.strip)
|
95
95
|
end
|
96
96
|
|
97
|
+
# Create a cookbook with a custom resource
|
98
|
+
#
|
99
|
+
# @author Tim Smith - tsmith@chef.io
|
100
|
+
# @since 10.1.1
|
101
|
+
def cookbook_with_custom_resource
|
102
|
+
write_resource("site", %Q{
|
103
|
+
property :name, String, name_property: true
|
104
|
+
property :variables, Hash, default: {}
|
105
|
+
|
106
|
+
action :create do
|
107
|
+
log "Here is where I would create a " + thing
|
108
|
+
end
|
109
|
+
|
110
|
+
action_class do
|
111
|
+
def thing
|
112
|
+
return "site"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
})
|
116
|
+
end
|
117
|
+
|
97
118
|
# Create a cookbook with a LRWP
|
98
119
|
#
|
99
120
|
# @param [Hash] lwrp The options to use for the created LWRP
|
data/lib/foodcritic/api.rb
CHANGED
@@ -85,7 +85,7 @@ module FoodCritic
|
|
85
85
|
# The absolute path of a cookbook from the specified file.
|
86
86
|
#
|
87
87
|
# @author Tim Smith - tsmith@chef.io
|
88
|
-
# @since
|
88
|
+
# @since 10.1
|
89
89
|
# @param file [String, Pathname] relative or absolute path to a file in the cookbook
|
90
90
|
# @return [String] the absolute path to the base of the cookbook
|
91
91
|
def cookbook_base_path(file)
|
@@ -1,6 +1,8 @@
|
|
1
1
|
rule "FC016", "LWRP does not declare a default action" do
|
2
2
|
tags %w{correctness lwrp}
|
3
3
|
resource do |ast, filename|
|
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='property'")
|
4
6
|
unless ["//ident/@value='default_action'",
|
5
7
|
"//def/bodystmt/descendant::assign/
|
6
8
|
var_field/ivar/@value='@action'"].any? { |expr| ast.xpath(expr) }
|
data/lib/foodcritic/version.rb
CHANGED
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: 10.1.
|
4
|
+
version: 10.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Crump
|
@@ -355,5 +355,5 @@ rubyforge_project:
|
|
355
355
|
rubygems_version: 2.6.11
|
356
356
|
signing_key:
|
357
357
|
specification_version: 4
|
358
|
-
summary: foodcritic-10.1.
|
358
|
+
summary: foodcritic-10.1.1
|
359
359
|
test_files: []
|