puppet-lint 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/README.md +9 -6
- data/lib/puppet-lint.rb +6 -0
- data/lib/puppet-lint/checkplugin.rb +9 -1
- data/lib/puppet-lint/checks.rb +1 -1
- data/lib/puppet-lint/data.rb +181 -2
- data/lib/puppet-lint/lexer.rb +3 -2
- data/lib/puppet-lint/lexer/token.rb +5 -0
- data/lib/puppet-lint/optparser.rb +14 -1
- data/lib/puppet-lint/plugins/check_classes.rb +12 -10
- data/lib/puppet-lint/plugins/check_comments.rb +1 -1
- data/lib/puppet-lint/plugins/check_conditionals.rb +5 -1
- data/lib/puppet-lint/plugins/check_nodes.rb +2 -1
- data/lib/puppet-lint/plugins/check_strings.rb +7 -2
- data/lib/puppet-lint/plugins/check_whitespace.rb +10 -9
- data/lib/puppet-lint/tasks/puppet-lint.rb +8 -1
- data/lib/puppet-lint/version.rb +1 -1
- data/spec/fixtures/test/manifests/url_interpolation.pp +12 -0
- data/spec/puppet-lint/lexer_spec.rb +1 -1
- data/spec/puppet-lint/plugins/check_classes/names_containing_dash_spec.rb +6 -6
- data/spec/puppet-lint/plugins/check_classes/variable_scope_spec.rb +22 -5
- data/spec/puppet-lint/plugins/check_conditionals/case_without_default_spec.rb +42 -0
- data/spec/puppet-lint/plugins/check_nodes/unquoted_node_name_spec.rb +13 -0
- data/spec/puppet-lint/plugins/check_resources/duplicate_params_spec.rb +8 -0
- data/spec/puppet-lint/plugins/check_strings/puppet_url_without_modules_spec.rb +43 -6
- data/spec/puppet-lint/plugins/check_whitespace/{80chars_spec.rb → 140chars_spec.rb} +7 -7
- data/spec/puppet-lint/plugins/check_whitespace/arrow_alignment_spec.rb +64 -0
- data/spec/puppet-lint/plugins/check_whitespace/trailing_whitespace_spec.rb +40 -0
- metadata +72 -94
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 42a8b6b721a2a3199c467e7e2de025cf4a5189d6
|
4
|
+
data.tar.gz: fafaf3e4ddb9cdd80176d593a52223e10783db49
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 40769d9d486fa42811c3eb8843ae74d8755cf2e10979a997de86b41037cb49824deb143abe2f8271cf2e623f49422cfa91fb88b573efd4429f3242a4ab09b82a
|
7
|
+
data.tar.gz: 0acbcca77675ffde239ee14b8bc4d071840c8a2c7ed585b080bde7da8690d8e45312a68410dc56bda0d5a7bc2260b9d16e91fd825f8243394c627bf3f4ee2fb1
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -38,7 +38,7 @@ the PuppetLint configuration by defining the task yourself.
|
|
38
38
|
config.ignore_paths = ['modules/apt', 'modules/stdlib']
|
39
39
|
|
40
40
|
# List of checks to disable
|
41
|
-
config.disable_checks = ['documentation', '
|
41
|
+
config.disable_checks = ['documentation', '140chars']
|
42
42
|
|
43
43
|
# Should puppet-lint prefix it's output with the file being checked,
|
44
44
|
# defaults to true
|
@@ -59,6 +59,9 @@ the PuppetLint configuration by defining the task yourself.
|
|
59
59
|
|
60
60
|
# Show ignored problems in the output, defaults to false
|
61
61
|
config.show_ignored = true
|
62
|
+
|
63
|
+
# Compare module layout relative to the module root
|
64
|
+
config.relative = true
|
62
65
|
end
|
63
66
|
|
64
67
|
## Implemented tests
|
@@ -70,7 +73,7 @@ At the moment, the following tests have been implemented:
|
|
70
73
|
* Must use two-space soft tabs.
|
71
74
|
* Must not use literal tab characters.
|
72
75
|
* Must not contain trailing white space.
|
73
|
-
* Should not exceed an
|
76
|
+
* Should not exceed an 140 character line width
|
74
77
|
* An exception has been made for `source => 'puppet://...'` lines as
|
75
78
|
splitting these over multiple lines decreases the readability of the
|
76
79
|
manifests.
|
@@ -121,10 +124,10 @@ At the moment, the following tests have been implemented:
|
|
121
124
|
|
122
125
|
You can disable any of the checks when running the `puppet-lint` command by
|
123
126
|
adding a `--no-<check name>-check` flag to the command. For example, if you
|
124
|
-
wanted to skip the
|
127
|
+
wanted to skip the 140 character check, you would run
|
125
128
|
|
126
129
|
```
|
127
|
-
puppet-lint --no-
|
130
|
+
puppet-lint --no-140chars-check /path/to/my/manifest.pp
|
128
131
|
```
|
129
132
|
|
130
133
|
puppet-lint will also check for a `.puppet-lint.rc` file in the current
|
@@ -152,10 +155,10 @@ task. Simply add the following line after the `require` statement in your
|
|
152
155
|
PuppetLint.configuration.send("disable_<check name>")
|
153
156
|
```
|
154
157
|
|
155
|
-
So, to disable the
|
158
|
+
So, to disable the 140 character check, you would add:
|
156
159
|
|
157
160
|
``` ruby
|
158
|
-
PuppetLint.configuration.send("
|
161
|
+
PuppetLint.configuration.send("disable_140chars")
|
159
162
|
```
|
160
163
|
|
161
164
|
The Rake task also supports ignoring certain paths
|
data/lib/puppet-lint.rb
CHANGED
@@ -164,6 +164,12 @@ class PuppetLint
|
|
164
164
|
raise PuppetLint::NoCodeError
|
165
165
|
end
|
166
166
|
|
167
|
+
if @code.empty?
|
168
|
+
@problems = []
|
169
|
+
@manifest = []
|
170
|
+
return
|
171
|
+
end
|
172
|
+
|
167
173
|
linter = PuppetLint::Checks.new
|
168
174
|
@problems = linter.run(@path, @code)
|
169
175
|
@problems.each { |problem| @statistics[problem[:kind]] += 1 }
|
@@ -35,7 +35,7 @@ class PuppetLint::CheckPlugin
|
|
35
35
|
#
|
36
36
|
# Returns an Array of problem Hashes.
|
37
37
|
def fix_problems
|
38
|
-
@problems.each do |problem|
|
38
|
+
@problems.reject { |problem| problem[:kind] == :ignored }.each do |problem|
|
39
39
|
if self.respond_to?(:fix)
|
40
40
|
begin
|
41
41
|
fix(problem)
|
@@ -90,6 +90,14 @@ class PuppetLint::CheckPlugin
|
|
90
90
|
PuppetLint::Data.defined_type_indexes
|
91
91
|
end
|
92
92
|
|
93
|
+
# Public: Provides positional information for any node definitions in the
|
94
|
+
# tokens array to the check plugins.
|
95
|
+
#
|
96
|
+
# Returns an Array of Hashes containing the position information.
|
97
|
+
def node_indexes
|
98
|
+
PuppetLint::Data.node_indexes
|
99
|
+
end
|
100
|
+
|
93
101
|
# Public: Provides the expanded path of the file being analysed to check
|
94
102
|
# plugins.
|
95
103
|
#
|
data/lib/puppet-lint/checks.rb
CHANGED
@@ -20,7 +20,7 @@ class PuppetLint::Checks
|
|
20
20
|
def load_data(path, content)
|
21
21
|
lexer = PuppetLint::Lexer.new
|
22
22
|
PuppetLint::Data.path = path
|
23
|
-
PuppetLint::Data.manifest_lines = content.split("\n")
|
23
|
+
PuppetLint::Data.manifest_lines = content.split("\n", -1)
|
24
24
|
begin
|
25
25
|
PuppetLint::Data.tokens = lexer.tokenise(content)
|
26
26
|
PuppetLint::Data.parse_control_comments
|
data/lib/puppet-lint/data.rb
CHANGED
@@ -25,13 +25,23 @@ class PuppetLint::Data
|
|
25
25
|
@resource_indexes = nil
|
26
26
|
@class_indexes = nil
|
27
27
|
@defined_type_indexes = nil
|
28
|
+
@function_indexes = nil
|
29
|
+
@array_indexes = nil
|
30
|
+
@hash_indexes = nil
|
31
|
+
@defaults_indexes = nil
|
28
32
|
end
|
29
33
|
|
30
34
|
# Public: Get the tokenised manifest.
|
31
35
|
#
|
32
36
|
# Returns an Array of PuppetLint::Lexer::Token objects.
|
33
37
|
def tokens
|
34
|
-
|
38
|
+
calling_method = begin
|
39
|
+
caller[0][/`.*'/][1..-2]
|
40
|
+
rescue NoMethodError
|
41
|
+
caller[1][/`.*'/][1..-2]
|
42
|
+
end
|
43
|
+
|
44
|
+
if calling_method == 'check'
|
35
45
|
@tokens.dup
|
36
46
|
else
|
37
47
|
@tokens
|
@@ -100,7 +110,7 @@ class PuppetLint::Data
|
|
100
110
|
if tokens[token_idx].type == :COLON
|
101
111
|
next_token = tokens[token_idx].next_code_token
|
102
112
|
depth = 1
|
103
|
-
if next_token.type != :LBRACE
|
113
|
+
if next_token && next_token.type != :LBRACE
|
104
114
|
tokens[(token_idx + 1)..-1].each_index do |idx|
|
105
115
|
real_idx = token_idx + idx + 1
|
106
116
|
if tokens[real_idx].type == :LBRACE
|
@@ -179,6 +189,20 @@ class PuppetLint::Data
|
|
179
189
|
@defined_type_indexes ||= definition_indexes(:DEFINE)
|
180
190
|
end
|
181
191
|
|
192
|
+
# Internal: Calculate the positions of all node definitions within the
|
193
|
+
# `tokens` Array.
|
194
|
+
#
|
195
|
+
# Returns an Array of Hashes, each containing:
|
196
|
+
# :start - An Integer position in the `tokens` Array pointing to the
|
197
|
+
# first Token of a defined type definition.
|
198
|
+
# :end - An Integer position in the `tokens` Array pointing to the last
|
199
|
+
# Token of a defined type definition.
|
200
|
+
# :tokens - An Array consisting of all the Token objects that make up the
|
201
|
+
# defined type.
|
202
|
+
def node_indexes
|
203
|
+
@node_indexes ||= definition_indexes(:NODE)
|
204
|
+
end
|
205
|
+
|
182
206
|
# Internal: Calculate the positions of all the specified defintion types
|
183
207
|
# within the `tokens` Array.
|
184
208
|
#
|
@@ -232,6 +256,161 @@ class PuppetLint::Data
|
|
232
256
|
result
|
233
257
|
end
|
234
258
|
|
259
|
+
# Internal: Calculate the positions of all function calls within
|
260
|
+
# `tokens` Array.
|
261
|
+
#
|
262
|
+
# Returns an Array of Hashes, each containing:
|
263
|
+
# :start - An Integer position in the `tokens` Array pointing to the
|
264
|
+
# first Token of a function call
|
265
|
+
# :end - An Integer position in the `tokens` Array pointing to the last
|
266
|
+
# Token of a function call
|
267
|
+
# :tokens - An Array consisting of all the Token objects that make up the
|
268
|
+
# function call.
|
269
|
+
def function_indexes
|
270
|
+
@function_indexes ||= Proc.new do
|
271
|
+
functions = []
|
272
|
+
tokens.each_with_index do |token, token_idx|
|
273
|
+
if token.type == :NAME && \
|
274
|
+
(token_idx == 0 || (token_idx == 1 && tokens[0].type == :WHITESPACE) || token.prev_token.type == :NEWLINE || token.prev_token.type == :INDENT || \
|
275
|
+
# function in a function
|
276
|
+
(token.prev_code_token && token.prev_code_token.type == :LPAREN))
|
277
|
+
|
278
|
+
# Hash key
|
279
|
+
next if token.next_code_token && token.next_code_token.type == :FARROW
|
280
|
+
|
281
|
+
level = 0
|
282
|
+
real_idx = 0
|
283
|
+
in_paren = false
|
284
|
+
tokens[token_idx+1..-1].each_with_index do |cur_token, cur_token_idx|
|
285
|
+
break if level == 0 && in_paren
|
286
|
+
break if level == 0 && cur_token.type == :NEWLINE
|
287
|
+
|
288
|
+
if cur_token.type == :LPAREN
|
289
|
+
level += 1
|
290
|
+
in_paren = true
|
291
|
+
end
|
292
|
+
level -= 1 if cur_token.type == :RPAREN
|
293
|
+
real_idx = token_idx + 1 + cur_token_idx
|
294
|
+
end
|
295
|
+
|
296
|
+
functions << {
|
297
|
+
:start => token_idx,
|
298
|
+
:end => real_idx,
|
299
|
+
:tokens => tokens[token_idx..real_idx],
|
300
|
+
}
|
301
|
+
end
|
302
|
+
end
|
303
|
+
functions
|
304
|
+
end.call
|
305
|
+
end
|
306
|
+
|
307
|
+
# Internal: Calculate the positions of all array values within
|
308
|
+
# `tokens` Array.
|
309
|
+
#
|
310
|
+
# Returns an Array of Hashes, each containing:
|
311
|
+
# :start - An Integer position in the `tokens` Array pointing to the
|
312
|
+
# first Token of an array value
|
313
|
+
# :end - An Integer position in the `tokens` Array pointing to the last
|
314
|
+
# Token of an array value
|
315
|
+
# :tokens - An Array consisting of all the Token objects that make up the
|
316
|
+
# array value.
|
317
|
+
def array_indexes
|
318
|
+
@array_indexes ||= Proc.new do
|
319
|
+
arrays = []
|
320
|
+
tokens.each_with_index do |token, token_idx|
|
321
|
+
if token.type == :LBRACK
|
322
|
+
real_idx = 0
|
323
|
+
tokens[token_idx+1..-1].each_with_index do |cur_token, cur_token_idx|
|
324
|
+
real_idx = token_idx + 1 + cur_token_idx
|
325
|
+
break if cur_token.type == :RBRACK
|
326
|
+
end
|
327
|
+
|
328
|
+
# Ignore resource references
|
329
|
+
next if token.prev_code_token && \
|
330
|
+
token.prev_code_token.type == :CLASSREF
|
331
|
+
arrays << {
|
332
|
+
:start => token_idx,
|
333
|
+
:end => real_idx,
|
334
|
+
:tokens => tokens[token_idx..real_idx],
|
335
|
+
}
|
336
|
+
end
|
337
|
+
end
|
338
|
+
arrays
|
339
|
+
end.call
|
340
|
+
end
|
341
|
+
|
342
|
+
# Internal: Calculate the positions of all hash values within
|
343
|
+
# `tokens` Array.
|
344
|
+
#
|
345
|
+
# Returns an Array of Hashes, each containing:
|
346
|
+
# :start - An Integer position in the `tokens` Array pointing to the
|
347
|
+
# first Token of an hash value
|
348
|
+
# :end - An Integer position in the `tokens` Array pointing to the last
|
349
|
+
# Token of an hash value
|
350
|
+
# :tokens - An Array consisting of all the Token objects that make up the
|
351
|
+
# hash value.
|
352
|
+
def hash_indexes
|
353
|
+
@hash_indexes ||= Proc.new do
|
354
|
+
hashes = []
|
355
|
+
tokens.each_with_index do |token, token_idx|
|
356
|
+
next unless token.prev_code_token
|
357
|
+
next unless [:EQUALS, :ISEQUAL, :FARROW, :LPAREN].include? token.prev_code_token.type
|
358
|
+
if token.type == :LBRACE
|
359
|
+
level = 0
|
360
|
+
real_idx = 0
|
361
|
+
tokens[token_idx+1..-1].each_with_index do |cur_token, cur_token_idx|
|
362
|
+
real_idx = token_idx + 1 + cur_token_idx
|
363
|
+
|
364
|
+
level += 1 if cur_token.type == :LBRACE
|
365
|
+
level -= 1 if cur_token.type == :RBRACE
|
366
|
+
break if level < 0
|
367
|
+
end
|
368
|
+
|
369
|
+
hashes << {
|
370
|
+
:start => token_idx,
|
371
|
+
:end => real_idx,
|
372
|
+
:tokens => tokens[token_idx..real_idx],
|
373
|
+
}
|
374
|
+
end
|
375
|
+
end
|
376
|
+
hashes
|
377
|
+
end.call
|
378
|
+
end
|
379
|
+
|
380
|
+
# Internal: Calculate the positions of all defaults declarations within
|
381
|
+
# `tokens` Array.
|
382
|
+
#
|
383
|
+
# Returns an Array of Hashes, each containing:
|
384
|
+
# :start - An Integer position in the `tokens` Array pointing to the
|
385
|
+
# first Token of the defaults declaration
|
386
|
+
# :end - An Integer position in the `tokens` Array pointing to the last
|
387
|
+
# Token of the defaults declaration
|
388
|
+
# :tokens - An Array consisting of all the Token objects that make up the
|
389
|
+
# defaults declaration.
|
390
|
+
def defaults_indexes
|
391
|
+
@defaults_indexes ||= Proc.new do
|
392
|
+
defaults = []
|
393
|
+
tokens.each_with_index do |token, token_idx|
|
394
|
+
if token.type == :CLASSREF && token.next_code_token && \
|
395
|
+
token.next_code_token.type == :LBRACE
|
396
|
+
real_idx = 0
|
397
|
+
|
398
|
+
tokens[token_idx+1..-1].each_with_index do |cur_token, cur_token_idx|
|
399
|
+
real_idx = token_idx + 1 + cur_token_idx
|
400
|
+
break if cur_token.type == :RBRACE
|
401
|
+
end
|
402
|
+
|
403
|
+
defaults << {
|
404
|
+
:start => token_idx,
|
405
|
+
:end => real_idx,
|
406
|
+
:tokens => tokens[token_idx..real_idx],
|
407
|
+
}
|
408
|
+
end
|
409
|
+
end
|
410
|
+
defaults
|
411
|
+
end.call
|
412
|
+
end
|
413
|
+
|
235
414
|
# Internal: Finds all the tokens that make up the defined type or class
|
236
415
|
# definition parameters.
|
237
416
|
#
|
data/lib/puppet-lint/lexer.rb
CHANGED
@@ -195,11 +195,12 @@ class PuppetLint
|
|
195
195
|
|
196
196
|
elsif mlcomment = chunk[/\A(\/\*.*?\*\/)/m, 1]
|
197
197
|
length = mlcomment.size
|
198
|
+
mlcomment_raw = mlcomment.dup
|
198
199
|
mlcomment.sub!(/\A\/\* ?/, '')
|
199
200
|
mlcomment.sub!(/ ?\*\/\Z/, '')
|
200
|
-
mlcomment.gsub!(
|
201
|
-
mlcomment.strip!
|
201
|
+
mlcomment.gsub!(/^ *\*/, '')
|
202
202
|
tokens << new_token(:MLCOMMENT, mlcomment, length)
|
203
|
+
tokens.last.raw = mlcomment_raw
|
203
204
|
|
204
205
|
elsif chunk.match(/\A\/.*?\//) && possible_regex?
|
205
206
|
str_content = StringScanner.new(code[i+1..-1]).scan_until(/(\A|[^\\])(\\\\)*\//m)
|
@@ -9,6 +9,9 @@ class PuppetLint
|
|
9
9
|
# Public: Returns the String value of the Token.
|
10
10
|
attr_accessor :value
|
11
11
|
|
12
|
+
# Public: Returns the raw value of the Token.
|
13
|
+
attr_accessor :raw
|
14
|
+
|
12
15
|
# Public: Returns the Integer line number of the manifest text where
|
13
16
|
# the Token can be found.
|
14
17
|
attr_reader :line
|
@@ -87,6 +90,8 @@ class PuppetLint
|
|
87
90
|
"##{@value}"
|
88
91
|
when :REGEX
|
89
92
|
"/#{@value}/"
|
93
|
+
when :MLCOMMENT
|
94
|
+
@raw
|
90
95
|
else
|
91
96
|
@value
|
92
97
|
end
|
@@ -58,6 +58,14 @@ class PuppetLint::OptParser
|
|
58
58
|
load f
|
59
59
|
end
|
60
60
|
|
61
|
+
opts.on('--load-from-puppet MODULEPATH', 'Load plugins from the given Puppet module path.') do |path|
|
62
|
+
path.split(':').each do |p|
|
63
|
+
Dir["#{p}/*/lib/puppet-lint/plugins/*.rb"].each do |file|
|
64
|
+
load file
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
61
69
|
opts.on('-f', '--fix', 'Attempt to automatically fix errors') do
|
62
70
|
PuppetLint.configuration.fix = true
|
63
71
|
end
|
@@ -98,7 +106,12 @@ class PuppetLint::OptParser
|
|
98
106
|
end
|
99
107
|
|
100
108
|
opts.load('/etc/puppet-lint.rc')
|
101
|
-
|
109
|
+
begin
|
110
|
+
opts.load(File.expand_path('~/.puppet-lint.rc')) if ENV['HOME']
|
111
|
+
rescue Errno::EACCES
|
112
|
+
# silently skip loading this file if HOME is set to a directory that
|
113
|
+
# the user doesn't have read access to.
|
114
|
+
end
|
102
115
|
opts.load('.puppet-lint.rc')
|
103
116
|
end
|
104
117
|
end
|
@@ -45,7 +45,7 @@ PuppetLint.new_check(:autoloader_layout) do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
# Public: Check the manifest tokens for any classes or defined types that
|
48
|
-
# have a dash in their name and record
|
48
|
+
# have a dash in their name and record an error for each instance found.
|
49
49
|
PuppetLint.new_check(:names_containing_dash) do
|
50
50
|
def check
|
51
51
|
(class_indexes + defined_type_indexes).each do |class_idx|
|
@@ -56,7 +56,7 @@ PuppetLint.new_check(:names_containing_dash) do
|
|
56
56
|
obj_type = 'defined type'
|
57
57
|
end
|
58
58
|
|
59
|
-
notify :
|
59
|
+
notify :error, {
|
60
60
|
:message => "#{obj_type} name containing a dash",
|
61
61
|
:line => class_idx[:name_token].line,
|
62
62
|
:column => class_idx[:name_token].column,
|
@@ -263,17 +263,19 @@ PuppetLint.new_check(:variable_scope) do
|
|
263
263
|
msg = "top-scope variable being used without an explicit namespace"
|
264
264
|
referenced_variables.each do |token|
|
265
265
|
unless future_parser_scopes[token.line].nil?
|
266
|
-
next if future_parser_scopes[token.line].include?(token.value)
|
266
|
+
next if future_parser_scopes[token.line].include?(token.value.gsub(/\[.+\]\Z/, ''))
|
267
267
|
end
|
268
268
|
|
269
269
|
unless token.value.include? '::'
|
270
|
-
unless
|
271
|
-
unless token.value
|
272
|
-
|
273
|
-
:
|
274
|
-
|
275
|
-
|
276
|
-
|
270
|
+
unless token.value =~ /^(facts|trusted)\[.+\]/
|
271
|
+
unless variables_in_scope.include? token.value.gsub(/\[.+\]\Z/, '')
|
272
|
+
unless token.value =~ /\A\d+\Z/
|
273
|
+
notify :warning, {
|
274
|
+
:message => msg,
|
275
|
+
:line => token.line,
|
276
|
+
:column => token.column,
|
277
|
+
}
|
278
|
+
end
|
277
279
|
end
|
278
280
|
end
|
279
281
|
end
|
@@ -36,7 +36,7 @@ PuppetLint.new_check(:star_comments) do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def fix(problem)
|
39
|
-
comment_lines = problem[:token].value.split("\n")
|
39
|
+
comment_lines = problem[:token].value.strip.split("\n").map(&:strip)
|
40
40
|
first_line = comment_lines.shift
|
41
41
|
problem[:token].type = :COMMENT
|
42
42
|
problem[:token].value = " #{first_line}"
|
@@ -46,9 +46,13 @@ PuppetLint.new_check(:case_without_default) do
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
case_indexes.
|
49
|
+
case_indexes.each_with_index do |kase,kase_index|
|
50
50
|
case_tokens = tokens[kase[:start]..kase[:end]]
|
51
51
|
|
52
|
+
case_indexes[(kase_index + 1)..-1].each do |successor_kase|
|
53
|
+
case_tokens -= tokens[successor_kase[:start]..successor_kase[:end]]
|
54
|
+
end
|
55
|
+
|
52
56
|
unless case_tokens.index { |r| r.type == :DEFAULT }
|
53
57
|
notify :warning, {
|
54
58
|
:message => 'case statement without a default case',
|
@@ -5,7 +5,8 @@ PuppetLint.new_check(:unquoted_node_name) do
|
|
5
5
|
node_tokens = tokens.select { |token| token.type == :NODE }
|
6
6
|
node_tokens.each do |node|
|
7
7
|
node_token_idx = tokens.index(node)
|
8
|
-
|
8
|
+
node_lbrace_tok = tokens[node_token_idx..-1].find { |token| token.type == :LBRACE }
|
9
|
+
node_lbrace_idx = tokens.index(node_lbrace_tok)
|
9
10
|
|
10
11
|
tokens[node_token_idx..node_lbrace_idx].select { |token|
|
11
12
|
token.type == :NAME
|
@@ -155,15 +155,20 @@ end
|
|
155
155
|
PuppetLint.new_check(:puppet_url_without_modules) do
|
156
156
|
def check
|
157
157
|
tokens.select { |token|
|
158
|
-
token.type == :SSTRING && token.value.start_with?('puppet://')
|
158
|
+
(token.type == :SSTRING || token.type == :STRING || token.type == :DQPRE) && token.value.start_with?('puppet://')
|
159
159
|
}.reject { |token|
|
160
|
-
token.value[/puppet:\/\/.*?\/(.+)/, 1].start_with?('modules/')
|
160
|
+
token.value[/puppet:\/\/.*?\/(.+)/, 1].start_with?('modules/') unless token.value[/puppet:\/\/.*?\/(.+)/, 1].nil?
|
161
161
|
}.each do |token|
|
162
162
|
notify :warning, {
|
163
163
|
:message => 'puppet:// URL without modules/ found',
|
164
164
|
:line => token.line,
|
165
165
|
:column => token.column,
|
166
|
+
:token => token,
|
166
167
|
}
|
167
168
|
end
|
168
169
|
end
|
170
|
+
|
171
|
+
def fix(problem)
|
172
|
+
problem[:token].value.gsub!(/(puppet:\/\/.*?\/)/, '\1modules/')
|
173
|
+
end
|
169
174
|
end
|
@@ -26,7 +26,7 @@ end
|
|
26
26
|
PuppetLint.new_check(:trailing_whitespace) do
|
27
27
|
def check
|
28
28
|
tokens.select { |token|
|
29
|
-
token.type
|
29
|
+
[:WHITESPACE, :INDENT].include?(token.type)
|
30
30
|
}.select { |token|
|
31
31
|
token.next_token.nil? || token.next_token.type == :NEWLINE
|
32
32
|
}.each do |token|
|
@@ -48,19 +48,19 @@ PuppetLint.new_check(:trailing_whitespace) do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
# Public: Test the raw manifest string for lines containing more than
|
51
|
+
# Public: Test the raw manifest string for lines containing more than 140
|
52
52
|
# characters and record a warning for each instance found. The only exceptions
|
53
53
|
# to this rule are lines containing URLs and template() calls which would hurt
|
54
54
|
# readability if split.
|
55
|
-
PuppetLint.new_check(:'
|
55
|
+
PuppetLint.new_check(:'140chars') do
|
56
56
|
def check
|
57
57
|
manifest_lines.each_with_index do |line, idx|
|
58
58
|
unless line =~ /:\/\// || line =~ /template\(/
|
59
|
-
if line.scan(/./mu).size >
|
59
|
+
if line.scan(/./mu).size > 140
|
60
60
|
notify :warning, {
|
61
|
-
:message => 'line has more than
|
61
|
+
:message => 'line has more than 140 characters',
|
62
62
|
:line => idx + 1,
|
63
|
-
:column =>
|
63
|
+
:column => 140,
|
64
64
|
}
|
65
65
|
end
|
66
66
|
end
|
@@ -112,7 +112,8 @@ PuppetLint.new_check(:arrow_alignment) do
|
|
112
112
|
if token.type == :FARROW
|
113
113
|
(level_tokens[indent_depth_idx] ||= []) << token
|
114
114
|
prev_indent_token = resource_tokens[0..idx].rindex { |t| t.type == :INDENT }
|
115
|
-
|
115
|
+
indent_token_length = prev_indent_token.nil? ? 0 : resource_tokens[prev_indent_token].to_manifest.length
|
116
|
+
indent_length = indent_token_length + token.prev_code_token.to_manifest.length + 2
|
116
117
|
|
117
118
|
if indent_depth[indent_depth_idx] < indent_length
|
118
119
|
indent_depth[indent_depth_idx] = indent_length
|
@@ -122,9 +123,9 @@ PuppetLint.new_check(:arrow_alignment) do
|
|
122
123
|
indent_depth_idx += 1
|
123
124
|
indent_depth << 0
|
124
125
|
level_tokens[indent_depth_idx] ||= []
|
125
|
-
elsif token.type == :RBRACE
|
126
|
+
elsif token.type == :RBRACE || token.type == :SEMIC
|
126
127
|
level_tokens[indent_depth_idx].each do |arrow_tok|
|
127
|
-
unless arrow_tok.column == indent_depth[indent_depth_idx]
|
128
|
+
unless arrow_tok.column == indent_depth[indent_depth_idx] || level_tokens[indent_depth_idx].size == 1
|
128
129
|
arrows_on_line = level_tokens[indent_depth_idx].select { |t| t.line == arrow_tok.line }
|
129
130
|
notify :warning, {
|
130
131
|
:message => 'indentation of => is not properly aligned',
|
@@ -26,6 +26,7 @@ class PuppetLint
|
|
26
26
|
attr_accessor :with_context
|
27
27
|
attr_accessor :fix
|
28
28
|
attr_accessor :show_ignored
|
29
|
+
attr_accessor :relative
|
29
30
|
|
30
31
|
# Public: Initialise a new PuppetLint::RakeTask.
|
31
32
|
#
|
@@ -49,6 +50,8 @@ class PuppetLint
|
|
49
50
|
|
50
51
|
task_block.call(*[self, args].slice(0, task_block.arity)) if task_block
|
51
52
|
|
53
|
+
# clear any (auto-)pre-existing task
|
54
|
+
Rake::Task[@name].clear if Rake::Task.task_defined?(@name)
|
52
55
|
task @name do
|
53
56
|
PuppetLint::OptParser.build
|
54
57
|
|
@@ -56,11 +59,15 @@ class PuppetLint
|
|
56
59
|
PuppetLint.configuration.send("disable_#{check}")
|
57
60
|
end
|
58
61
|
|
59
|
-
%w{with_filename fail_on_warnings error_level log_format with_context fix show_ignored}.each do |config|
|
62
|
+
%w{with_filename fail_on_warnings error_level log_format with_context fix show_ignored relative}.each do |config|
|
60
63
|
value = instance_variable_get("@#{config}")
|
61
64
|
PuppetLint.configuration.send("#{config}=".to_sym, value) unless value.nil?
|
62
65
|
end
|
63
66
|
|
67
|
+
if PuppetLint.configuration.ignore_paths
|
68
|
+
@ignore_paths = PuppetLint.configuration.ignore_paths
|
69
|
+
end
|
70
|
+
|
64
71
|
RakeFileUtils.send(:verbose, true) do
|
65
72
|
linter = PuppetLint.new
|
66
73
|
matched_files = FileList[@pattern]
|
data/lib/puppet-lint/version.rb
CHANGED
@@ -687,7 +687,7 @@ describe PuppetLint::Lexer do
|
|
687
687
|
it 'should match comments on multiple lines' do
|
688
688
|
token = @lexer.tokenise("/* foo\n * bar\n*/").first
|
689
689
|
expect(token.type).to eq(:MLCOMMENT)
|
690
|
-
expect(token.value).to eq("foo\
|
690
|
+
expect(token.value).to eq("foo\n bar\n")
|
691
691
|
end
|
692
692
|
end
|
693
693
|
|
@@ -12,8 +12,8 @@ describe 'names_containing_dash' do
|
|
12
12
|
expect(problems).to have(1).problem
|
13
13
|
end
|
14
14
|
|
15
|
-
it 'should create
|
16
|
-
expect(problems).to
|
15
|
+
it 'should create an error' do
|
16
|
+
expect(problems).to contain_error(class_msg).on_line(1).in_column(7)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -25,8 +25,8 @@ describe 'names_containing_dash' do
|
|
25
25
|
expect(problems).to have(1).problem
|
26
26
|
end
|
27
27
|
|
28
|
-
it 'should create
|
29
|
-
expect(problems).to
|
28
|
+
it 'should create an error' do
|
29
|
+
expect(problems).to contain_error(define_msg).on_line(1).in_column(8)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -38,8 +38,8 @@ describe 'names_containing_dash' do
|
|
38
38
|
expect(problems).to have(1).problem
|
39
39
|
end
|
40
40
|
|
41
|
-
it 'should create
|
42
|
-
expect(problems).to
|
41
|
+
it 'should create an error' do
|
42
|
+
expect(problems).to contain_error(class_msg).on_line(1).in_column(7)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -147,16 +147,19 @@ describe 'variable_scope' do
|
|
147
147
|
context 'future parser blocks' do
|
148
148
|
let(:code) { "
|
149
149
|
class foo() {
|
150
|
-
$foo =
|
150
|
+
$foo = {1=>2, 3=>4}
|
151
151
|
$foo.each |$a, $b| {
|
152
|
-
$a
|
153
|
-
$c
|
152
|
+
$a # should cause no warnings
|
153
|
+
$c # top-scope variable warning
|
154
|
+
}
|
155
|
+
$b # top-scope variable warning
|
156
|
+
$foo.each |$d| {
|
157
|
+
$d[1] # should cause no warnings
|
154
158
|
}
|
155
|
-
$b
|
156
159
|
}
|
157
160
|
" }
|
158
161
|
|
159
|
-
it 'should only detect
|
162
|
+
it 'should only detect two problems' do
|
160
163
|
expect(problems).to have(2).problem
|
161
164
|
end
|
162
165
|
|
@@ -179,4 +182,18 @@ describe 'variable_scope' do
|
|
179
182
|
end
|
180
183
|
end
|
181
184
|
end
|
185
|
+
|
186
|
+
context 'support the use of facts and trusted facts for Puppet 3.5 onwards' do
|
187
|
+
let(:code) { "
|
188
|
+
class foo() {
|
189
|
+
if $facts['osfamily'] == 'redhat' or $trusted['osfamily'] == 'redhat' {
|
190
|
+
$redhat = true
|
191
|
+
}
|
192
|
+
}
|
193
|
+
" }
|
194
|
+
|
195
|
+
it 'should not detect any problems' do
|
196
|
+
expect(problems).to have(0).problems
|
197
|
+
end
|
198
|
+
end
|
182
199
|
end
|
@@ -32,6 +32,48 @@ describe 'case_without_default' do
|
|
32
32
|
expect(problems).to contain_warning(msg).on_line(2).in_column(7)
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
context 'nested case statements without a default case on the outermost' do
|
37
|
+
let(:code) { "
|
38
|
+
case $foo {
|
39
|
+
case $foop {
|
40
|
+
bar: {}
|
41
|
+
default: {}
|
42
|
+
}
|
43
|
+
}"
|
44
|
+
}
|
45
|
+
|
46
|
+
it 'should only detect a single problem' do
|
47
|
+
expect(problems).to have(1).problem
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should create a warning' do
|
51
|
+
expect(problems).to contain_warning(msg)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'three nested case statements with two missing default cases' do
|
56
|
+
let(:code) { "
|
57
|
+
case $foo {
|
58
|
+
case $foop {
|
59
|
+
bar: {}
|
60
|
+
case $woop {
|
61
|
+
baz: {}
|
62
|
+
}
|
63
|
+
default: {}
|
64
|
+
}
|
65
|
+
}"
|
66
|
+
}
|
67
|
+
|
68
|
+
it 'should detect two problems' do
|
69
|
+
expect(problems).to have(2).problems
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'should create two warnings' do
|
73
|
+
expect(problems).to contain_warning(msg).on_line(2).in_column(7)
|
74
|
+
expect(problems).to contain_warning(msg).on_line(5).in_column(4)
|
75
|
+
end
|
76
|
+
end
|
35
77
|
|
36
78
|
context 'issue-117' do
|
37
79
|
let(:code) { "
|
@@ -66,6 +66,19 @@ describe 'unquoted_node_name' do
|
|
66
66
|
expect(problems).to contain_warning(msg).on_line(1).in_column(18)
|
67
67
|
end
|
68
68
|
end
|
69
|
+
|
70
|
+
context 'multiple node blocks' do
|
71
|
+
let(:code) { "node foo { } node bar { }" }
|
72
|
+
|
73
|
+
it 'should detect 2 problems' do
|
74
|
+
expect(problems).to have(2).problems
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'should create 2 warnings' do
|
78
|
+
expect(problems).to contain_warning(msg).on_line(1).in_column(6)
|
79
|
+
expect(problems).to contain_warning(msg).on_line(1).in_column(19)
|
80
|
+
end
|
81
|
+
end
|
69
82
|
end
|
70
83
|
|
71
84
|
context 'with fix enabled' do
|
@@ -89,4 +89,12 @@ describe 'duplicate_params' do
|
|
89
89
|
expect(problems).to have(0).problems
|
90
90
|
end
|
91
91
|
end
|
92
|
+
|
93
|
+
context 'colon as last token in file' do
|
94
|
+
let(:code) { "}:" }
|
95
|
+
|
96
|
+
it 'should not detect any problems' do
|
97
|
+
expect(problems).to have(0).problems
|
98
|
+
end
|
99
|
+
end
|
92
100
|
end
|
@@ -11,15 +11,52 @@ describe 'puppet_url_without_modules' do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
context '
|
15
|
-
|
14
|
+
context 'with fix disabled' do
|
15
|
+
context 'puppet:// url without modules' do
|
16
|
+
let(:code) { "'puppet:///foo'" }
|
16
17
|
|
17
|
-
|
18
|
-
|
18
|
+
it 'should only detect a single problem' do
|
19
|
+
expect(problems).to have(1).problem
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should create a warning' do
|
23
|
+
expect(problems).to contain_warning(msg).on_line(1).in_column(1)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'with fix enabled' do
|
29
|
+
before do
|
30
|
+
PuppetLint.configuration.fix = true
|
19
31
|
end
|
20
32
|
|
21
|
-
|
22
|
-
|
33
|
+
after do
|
34
|
+
PuppetLint.configuration.fix = false
|
23
35
|
end
|
36
|
+
|
37
|
+
context 'puppet:// url without modules' do
|
38
|
+
let(:code) { "'puppet:///foo'" }
|
39
|
+
|
40
|
+
it 'should only detect a single problem' do
|
41
|
+
expect(problems).to have(1).problem
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should fix the manifest' do
|
45
|
+
expect(problems).to contain_fixed(msg).on_line(1).in_column(1)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should insert modules into the path' do
|
49
|
+
expect(manifest).to eq("'puppet:///modules/foo'")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'double string wrapped puppet:// urls' do
|
55
|
+
let(:code) { File.read('spec/fixtures/test/manifests/url_interpolation.pp') }
|
56
|
+
|
57
|
+
it 'should detect several problems' do
|
58
|
+
expect(problems).to have(4).problem
|
59
|
+
end
|
60
|
+
|
24
61
|
end
|
25
62
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe '
|
5
|
-
let(:msg) { 'line has more than
|
4
|
+
describe '140chars' do
|
5
|
+
let(:msg) { 'line has more than 140 characters' }
|
6
6
|
|
7
|
-
context 'file resource with a source line >
|
7
|
+
context 'file resource with a source line > 140c' do
|
8
8
|
let(:code) { "
|
9
9
|
file {
|
10
10
|
source => 'puppet:///modules/certificates/etc/ssl/private/wildcard.example.com.crt',
|
@@ -16,7 +16,7 @@ describe '80chars' do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
context 'file resource with a template line >
|
19
|
+
context 'file resource with a template line > 140c' do
|
20
20
|
let(:code) { "
|
21
21
|
file {
|
22
22
|
content => template('mymodule/this/is/a/truely/absurdly/long/path/that/should/make/you/feel/bad'),
|
@@ -40,15 +40,15 @@ describe '80chars' do
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
context '
|
44
|
-
let(:code) { 'a' *
|
43
|
+
context '141 character line' do
|
44
|
+
let(:code) { 'a' * 141 }
|
45
45
|
|
46
46
|
it 'should only detect a single problem' do
|
47
47
|
expect(problems).to have(1).problem
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'should create a warning' do
|
51
|
-
expect(problems).to contain_warning(msg).on_line(1).in_column(
|
51
|
+
expect(problems).to contain_warning(msg).on_line(1).in_column(140)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -126,6 +126,28 @@ describe 'arrow_alignment' do
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
+
context 'single resource with a misaligned => and semicolon at the end' do
|
130
|
+
let(:code) { "
|
131
|
+
file { '/tmp/bar':
|
132
|
+
foo => 1,
|
133
|
+
bar => 2,
|
134
|
+
gronk => 3,
|
135
|
+
baz => 4,
|
136
|
+
meh => 5;
|
137
|
+
}"
|
138
|
+
}
|
139
|
+
|
140
|
+
it 'should detect four problems' do
|
141
|
+
expect(problems).to have(4).problems
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'should create four warnings' do
|
145
|
+
expect(problems).to contain_warning(msg).on_line(3).in_column(15)
|
146
|
+
expect(problems).to contain_warning(msg).on_line(4).in_column(15)
|
147
|
+
expect(problems).to contain_warning(msg).on_line(6).in_column(16)
|
148
|
+
expect(problems).to contain_warning(msg).on_line(7).in_column(15)
|
149
|
+
end
|
150
|
+
end
|
129
151
|
context 'complex resource with a misaligned =>' do
|
130
152
|
let(:code) { "
|
131
153
|
file { '/tmp/foo':
|
@@ -171,6 +193,34 @@ describe 'arrow_alignment' do
|
|
171
193
|
end
|
172
194
|
end
|
173
195
|
|
196
|
+
context 'multi-resource with a misaligned => and semicolons' do
|
197
|
+
let(:code) { "
|
198
|
+
file {
|
199
|
+
'/tmp/foo':
|
200
|
+
ensure => 'directory',
|
201
|
+
owner => 'root',
|
202
|
+
mode => '0755';
|
203
|
+
'/tmp/bar':
|
204
|
+
ensure => 'directory';
|
205
|
+
'/tmp/baz':
|
206
|
+
ensure => 'directory',
|
207
|
+
owner => 'root',
|
208
|
+
mode => '0755';
|
209
|
+
}"
|
210
|
+
}
|
211
|
+
|
212
|
+
it 'should only detect a single problem' do
|
213
|
+
expect(problems).to have(4).problem
|
214
|
+
end
|
215
|
+
|
216
|
+
it 'should create a warning' do
|
217
|
+
expect(problems).to contain_warning(msg).on_line(5).in_column(19)
|
218
|
+
expect(problems).to contain_warning(msg).on_line(6).in_column(18)
|
219
|
+
expect(problems).to contain_warning(msg).on_line(11).in_column(19)
|
220
|
+
expect(problems).to contain_warning(msg).on_line(12).in_column(18)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
174
224
|
context 'multiple single line resources' do
|
175
225
|
let(:code) { "
|
176
226
|
file { 'foo': ensure => file }
|
@@ -268,6 +318,20 @@ describe 'arrow_alignment' do
|
|
268
318
|
expect(problems).to contain_warning(msg).on_line(3).in_column(26)
|
269
319
|
end
|
270
320
|
end
|
321
|
+
|
322
|
+
context 'resource param containing a single-element same-line hash' do
|
323
|
+
let(:code) { "
|
324
|
+
foo { 'foo':
|
325
|
+
a => true,
|
326
|
+
b => { 'a' => 'b' }
|
327
|
+
}
|
328
|
+
"}
|
329
|
+
|
330
|
+
it 'should not detect any problems' do
|
331
|
+
expect(problems).to have(0).problems
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
271
335
|
end
|
272
336
|
|
273
337
|
context 'with fix enabled' do
|
@@ -15,6 +15,22 @@ describe 'trailing_whitespace' do
|
|
15
15
|
expect(problems).to contain_error(msg).on_line(1).in_column(4)
|
16
16
|
end
|
17
17
|
end
|
18
|
+
|
19
|
+
context 'line without code and trailing whitespace' do
|
20
|
+
let(:code) { "
|
21
|
+
class {
|
22
|
+
|
23
|
+
}
|
24
|
+
" }
|
25
|
+
|
26
|
+
it 'should only detect a single problem' do
|
27
|
+
expect(problems).to have(1).problem
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should create an error' do
|
31
|
+
expect(problems).to contain_error(msg).on_line(3).in_column(1)
|
32
|
+
end
|
33
|
+
end
|
18
34
|
end
|
19
35
|
|
20
36
|
context 'with fix enabled' do
|
@@ -57,5 +73,29 @@ describe 'trailing_whitespace' do
|
|
57
73
|
expect(manifest).to eq("foo\nbar")
|
58
74
|
end
|
59
75
|
end
|
76
|
+
|
77
|
+
context 'line without code and trailing whitespace' do
|
78
|
+
let(:code) { "
|
79
|
+
class foo {
|
80
|
+
|
81
|
+
}
|
82
|
+
" }
|
83
|
+
let(:fixed) { "
|
84
|
+
class foo {
|
85
|
+
|
86
|
+
}
|
87
|
+
" }
|
88
|
+
it 'should only detect a single problem' do
|
89
|
+
expect(problems).to have(1).problem
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'should create an error' do
|
93
|
+
expect(problems).to contain_fixed(msg).on_line(3).in_column(1)
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'should remove the trailing whitespace' do
|
97
|
+
expect(manifest).to eq(fixed)
|
98
|
+
end
|
99
|
+
end
|
60
100
|
end
|
61
101
|
end
|
metadata
CHANGED
@@ -1,94 +1,80 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-lint
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 1.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Tim Sharpe
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2016-06-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
22
14
|
name: rake
|
23
|
-
|
24
|
-
|
25
|
-
none: false
|
26
|
-
requirements:
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
27
17
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 10
|
32
|
-
- 0
|
33
|
-
version: "10.0"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '10.0'
|
34
20
|
type: :development
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rspec
|
38
21
|
prerelease: false
|
39
|
-
|
40
|
-
|
41
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '10.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
42
31
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 3
|
47
|
-
- 0
|
48
|
-
version: "3.0"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
49
34
|
type: :development
|
50
|
-
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: rspec-its
|
53
35
|
prerelease: false
|
54
|
-
|
55
|
-
|
56
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-its
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
57
45
|
- - ~>
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
segments:
|
61
|
-
- 1
|
62
|
-
- 0
|
63
|
-
version: "1.0"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
64
48
|
type: :development
|
65
|
-
version_requirements: *id003
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
name: rspec-collection_matchers
|
68
49
|
prerelease: false
|
69
|
-
|
70
|
-
|
71
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-collection_matchers
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
72
59
|
- - ~>
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
|
75
|
-
segments:
|
76
|
-
- 1
|
77
|
-
- 0
|
78
|
-
version: "1.0"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
79
62
|
type: :development
|
80
|
-
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
81
69
|
description: |-
|
82
70
|
Checks your Puppet manifests against the Puppetlabs
|
83
71
|
style guide and alerts you to any discrepancies.
|
84
72
|
email: tim@sharpe.id.au
|
85
|
-
executables:
|
73
|
+
executables:
|
86
74
|
- puppet-lint
|
87
75
|
extensions: []
|
88
|
-
|
89
76
|
extra_rdoc_files: []
|
90
|
-
|
91
|
-
files:
|
77
|
+
files:
|
92
78
|
- .gitignore
|
93
79
|
- .travis.yml
|
94
80
|
- Gemfile
|
@@ -128,6 +114,7 @@ files:
|
|
128
114
|
- spec/fixtures/test/manifests/ignore_reason.pp
|
129
115
|
- spec/fixtures/test/manifests/init.pp
|
130
116
|
- spec/fixtures/test/manifests/malformed.pp
|
117
|
+
- spec/fixtures/test/manifests/url_interpolation.pp
|
131
118
|
- spec/fixtures/test/manifests/warning.pp
|
132
119
|
- spec/puppet-lint/bin_spec.rb
|
133
120
|
- spec/puppet-lint/configuration_spec.rb
|
@@ -161,48 +148,37 @@ files:
|
|
161
148
|
- spec/puppet-lint/plugins/check_strings/single_quote_string_with_variables_spec.rb
|
162
149
|
- spec/puppet-lint/plugins/check_strings/variables_not_enclosed_spec.rb
|
163
150
|
- spec/puppet-lint/plugins/check_variables/variable_contains_dash_spec.rb
|
151
|
+
- spec/puppet-lint/plugins/check_whitespace/140chars_spec.rb
|
164
152
|
- spec/puppet-lint/plugins/check_whitespace/2sp_soft_tabs_spec.rb
|
165
|
-
- spec/puppet-lint/plugins/check_whitespace/80chars_spec.rb
|
166
153
|
- spec/puppet-lint/plugins/check_whitespace/arrow_alignment_spec.rb
|
167
154
|
- spec/puppet-lint/plugins/check_whitespace/hard_tabs_spec.rb
|
168
155
|
- spec/puppet-lint/plugins/check_whitespace/trailing_whitespace_spec.rb
|
169
156
|
- spec/puppet-lint_spec.rb
|
170
157
|
- spec/spec_helper.rb
|
171
|
-
has_rdoc: true
|
172
158
|
homepage: https://github.com/rodjek/puppet-lint/
|
173
159
|
licenses: []
|
174
|
-
|
160
|
+
metadata: {}
|
175
161
|
post_install_message:
|
176
162
|
rdoc_options: []
|
177
|
-
|
178
|
-
require_paths:
|
163
|
+
require_paths:
|
179
164
|
- lib
|
180
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
none: false
|
191
|
-
requirements:
|
192
|
-
- - ">="
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
hash: 3
|
195
|
-
segments:
|
196
|
-
- 0
|
197
|
-
version: "0"
|
165
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - '>='
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - '>='
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
198
175
|
requirements: []
|
199
|
-
|
200
176
|
rubyforge_project:
|
201
|
-
rubygems_version:
|
177
|
+
rubygems_version: 2.0.14
|
202
178
|
signing_key:
|
203
|
-
specification_version:
|
179
|
+
specification_version: 4
|
204
180
|
summary: Ensure your Puppet manifests conform with the Puppetlabs style guide
|
205
|
-
test_files:
|
181
|
+
test_files:
|
206
182
|
- spec/fixtures/test/manifests/fail.pp
|
207
183
|
- spec/fixtures/test/manifests/ignore.pp
|
208
184
|
- spec/fixtures/test/manifests/ignore_multiple_block.pp
|
@@ -210,6 +186,7 @@ test_files:
|
|
210
186
|
- spec/fixtures/test/manifests/ignore_reason.pp
|
211
187
|
- spec/fixtures/test/manifests/init.pp
|
212
188
|
- spec/fixtures/test/manifests/malformed.pp
|
189
|
+
- spec/fixtures/test/manifests/url_interpolation.pp
|
213
190
|
- spec/fixtures/test/manifests/warning.pp
|
214
191
|
- spec/puppet-lint/bin_spec.rb
|
215
192
|
- spec/puppet-lint/configuration_spec.rb
|
@@ -243,10 +220,11 @@ test_files:
|
|
243
220
|
- spec/puppet-lint/plugins/check_strings/single_quote_string_with_variables_spec.rb
|
244
221
|
- spec/puppet-lint/plugins/check_strings/variables_not_enclosed_spec.rb
|
245
222
|
- spec/puppet-lint/plugins/check_variables/variable_contains_dash_spec.rb
|
223
|
+
- spec/puppet-lint/plugins/check_whitespace/140chars_spec.rb
|
246
224
|
- spec/puppet-lint/plugins/check_whitespace/2sp_soft_tabs_spec.rb
|
247
|
-
- spec/puppet-lint/plugins/check_whitespace/80chars_spec.rb
|
248
225
|
- spec/puppet-lint/plugins/check_whitespace/arrow_alignment_spec.rb
|
249
226
|
- spec/puppet-lint/plugins/check_whitespace/hard_tabs_spec.rb
|
250
227
|
- spec/puppet-lint/plugins/check_whitespace/trailing_whitespace_spec.rb
|
251
228
|
- spec/puppet-lint_spec.rb
|
252
229
|
- spec/spec_helper.rb
|
230
|
+
has_rdoc:
|