foodcritic 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/foodcritic/command_line.rb +16 -0
- data/lib/foodcritic/domain.rb +8 -2
- data/lib/foodcritic/linter.rb +10 -1
- data/lib/foodcritic/version.rb +1 -1
- metadata +6 -18
|
@@ -76,6 +76,14 @@ module FoodCritic
|
|
|
76
76
|
"foodcritic #{FoodCritic::VERSION}"
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
+
# If the cookbook path provided is valid
|
|
80
|
+
#
|
|
81
|
+
# @deprecated Multiple cookbook paths may be provided.
|
|
82
|
+
# @return [Boolean] True if the path exists.
|
|
83
|
+
def valid_path?
|
|
84
|
+
@args.length == 1 and File.exists?(@args[0])
|
|
85
|
+
end
|
|
86
|
+
|
|
79
87
|
# If the cookbook paths provided are valid
|
|
80
88
|
#
|
|
81
89
|
# @return [Boolean] True if the paths exist.
|
|
@@ -83,6 +91,14 @@ module FoodCritic
|
|
|
83
91
|
@args.any? && @args.all? {|path| File.exists?(path) }
|
|
84
92
|
end
|
|
85
93
|
|
|
94
|
+
# The cookbook path.
|
|
95
|
+
#
|
|
96
|
+
# @deprecated Multiple cookbook paths may be provided.
|
|
97
|
+
# @return [String] Path to the cookbook(s) being checked.
|
|
98
|
+
def cookbook_path
|
|
99
|
+
@args[0]
|
|
100
|
+
end
|
|
101
|
+
|
|
86
102
|
# The cookbook paths
|
|
87
103
|
#
|
|
88
104
|
# @return [Array<String>] Path(s) to the cookbook(s) being checked.
|
data/lib/foodcritic/domain.rb
CHANGED
|
@@ -24,16 +24,22 @@ module FoodCritic
|
|
|
24
24
|
|
|
25
25
|
# Create a new review
|
|
26
26
|
#
|
|
27
|
-
# @param [
|
|
27
|
+
# @param [Array] cookbook_paths The path this review was performed against
|
|
28
28
|
# @param [Array] warnings The warnings raised in this review
|
|
29
29
|
# @param [Boolean] is_failed Have warnings been raised that mean this
|
|
30
30
|
# should be considered failed?
|
|
31
31
|
def initialize(cookbook_paths, warnings, is_failed)
|
|
32
|
-
@cookbook_paths = cookbook_paths
|
|
32
|
+
@cookbook_paths = Array(cookbook_paths)
|
|
33
33
|
@warnings = warnings
|
|
34
34
|
@is_failed = is_failed
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
+
# Provided for backwards compatibility
|
|
38
|
+
# @deprecated Multiple cookbook paths may be provided.
|
|
39
|
+
def cookbook_path
|
|
40
|
+
@cookbook_paths.first
|
|
41
|
+
end
|
|
42
|
+
|
|
37
43
|
# If this review has failed or not.
|
|
38
44
|
#
|
|
39
45
|
# @return [Boolean] True if this review has failed.
|
data/lib/foodcritic/linter.rb
CHANGED
|
@@ -42,15 +42,24 @@ module FoodCritic
|
|
|
42
42
|
# Review the cookbooks at the provided path, identifying potential
|
|
43
43
|
# improvements.
|
|
44
44
|
#
|
|
45
|
-
# @param [
|
|
45
|
+
# @param [Array] cookbook_paths The file path(s) to the individual
|
|
46
46
|
# cookbook(s) being checked
|
|
47
47
|
# @param [Hash] options Options to apply to the linting
|
|
48
|
+
# @option options [Array] include_rules Paths to local rules to apply
|
|
48
49
|
# @option options [Array] tags The tags to filter rules based on
|
|
49
50
|
# @option options [Array] fail_tags The tags to fail the build on
|
|
50
51
|
# @return [FoodCritic::Review] A review of your cookbooks, with any
|
|
51
52
|
# warnings issued.
|
|
52
53
|
def check(cookbook_paths, options)
|
|
53
54
|
raise ArgumentError, "Cookbook paths are required" if cookbook_paths.nil?
|
|
55
|
+
cookbook_paths = Array(cookbook_paths)
|
|
56
|
+
if cookbook_paths.empty?
|
|
57
|
+
raise ArgumentError, "Cookbook paths cannot be empty"
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
options = {:tags => [], :fail_tags => [],
|
|
61
|
+
:include_rules => []}.merge(options)
|
|
62
|
+
|
|
54
63
|
@last_cookbook_paths, @last_options = cookbook_paths, options
|
|
55
64
|
load_rules unless defined? @rules
|
|
56
65
|
warnings = []; last_dir = nil; matched_rule_tags = Set.new
|
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: 1.3.
|
|
4
|
+
version: 1.3.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-
|
|
12
|
+
date: 2012-06-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: gherkin
|
|
@@ -48,29 +48,17 @@ dependencies:
|
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
|
49
49
|
none: false
|
|
50
50
|
requirements:
|
|
51
|
-
- -
|
|
51
|
+
- - '='
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
53
|
version: 1.5.0
|
|
54
|
-
- - ! '!='
|
|
55
|
-
- !ruby/object:Gem::Version
|
|
56
|
-
version: 1.5.1
|
|
57
|
-
- - ! '!='
|
|
58
|
-
- !ruby/object:Gem::Version
|
|
59
|
-
version: 1.5.2
|
|
60
54
|
type: :runtime
|
|
61
55
|
prerelease: false
|
|
62
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
63
57
|
none: false
|
|
64
58
|
requirements:
|
|
65
|
-
- -
|
|
59
|
+
- - '='
|
|
66
60
|
- !ruby/object:Gem::Version
|
|
67
61
|
version: 1.5.0
|
|
68
|
-
- - ! '!='
|
|
69
|
-
- !ruby/object:Gem::Version
|
|
70
|
-
version: 1.5.1
|
|
71
|
-
- - ! '!='
|
|
72
|
-
- !ruby/object:Gem::Version
|
|
73
|
-
version: 1.5.2
|
|
74
62
|
- !ruby/object:Gem::Dependency
|
|
75
63
|
name: pry
|
|
76
64
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -193,12 +181,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
193
181
|
version: '0'
|
|
194
182
|
segments:
|
|
195
183
|
- 0
|
|
196
|
-
hash:
|
|
184
|
+
hash: 2247396416415780367
|
|
197
185
|
requirements: []
|
|
198
186
|
rubyforge_project:
|
|
199
187
|
rubygems_version: 1.8.19
|
|
200
188
|
signing_key:
|
|
201
189
|
specification_version: 3
|
|
202
|
-
summary: foodcritic-1.3.
|
|
190
|
+
summary: foodcritic-1.3.1
|
|
203
191
|
test_files: []
|
|
204
192
|
has_rdoc:
|