puppet-lint 2.1.0 → 2.1.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: afe0f69ff9db46b574f04cdb2344e600ae0b1e10
4
- data.tar.gz: 8c8344befd98f41083fc3e0408e5ae4ba1017245
3
+ metadata.gz: 09c3216991dd5d40c797bb951adeef212f612456
4
+ data.tar.gz: ac37d47099b67bf5693ce27b8312fcff4648419e
5
5
  SHA512:
6
- metadata.gz: 41c27ca6ec8948d1c2e654c830cad26806243643f4e0e8c29f2aad9ba7f215a2be1196fb7bed16bec0b541955e9235a43f7ccdfddf519a81505779ef806bc3e1
7
- data.tar.gz: 398daafadce6e29e4d97d116166658a76ad9d6fcd3fa2cbac12f7b4a204524eb1333d8b45bb96188129a0828ef8f6bb334cee77eddd9c103f2bc8198776e04b2
6
+ metadata.gz: f66775062fc637446250708ff5fb9fb5106a38bc758a6276bf325a7db6b97c4a50f528b964cc0bda44e1c550c8cc2b38ac0d83489dc1f97e9508c2a43c350337
7
+ data.tar.gz: 41b45bc46f3be42f046319ffdc588cdc70df842da61cdd098e032b44ba752d805128a88d95296b66b91d35313608230dff491de010e5e10f195ec9bb184e4498
data/.travis.yml CHANGED
@@ -1,8 +1,7 @@
1
1
  ---
2
2
  language: ruby
3
3
  sudo: false
4
- cache: bundler
5
- before_install: gem update --system 2.1.11
4
+ before_install: gem update --system && gem install bundler
6
5
  branches:
7
6
  only:
8
7
  - master
@@ -12,8 +11,11 @@ rvm:
12
11
  - 1.9.3
13
12
  - 2.0.0
14
13
  - 2.1.9
15
- - 2.2.4
16
14
  - 2.3.1
15
+ - 2.4.0
16
+ matrix:
17
+ allow_failures:
18
+ - rvm: 1.8.7
17
19
  notifications:
18
20
  email:
19
- - tim@github.com
21
+ - tim@bombasticmonkey.com
data/CHANGELOG.md CHANGED
@@ -1,40 +1,58 @@
1
1
  # Change Log
2
2
 
3
+ ## [2.1.1](https://github.com/rodjek/puppet-lint/tree/2.1.1) (2017-02-13)
4
+ [Full Changelog](https://github.com/rodjek/puppet-lint/compare/2.1.0...2.1.1)
5
+
6
+ **Closed issues:**
7
+
8
+ - False positive detection in double quoted string containing no variables [\#618](https://github.com/rodjek/puppet-lint/issues/618)
9
+ - Warning and error classification [\#614](https://github.com/rodjek/puppet-lint/issues/614)
10
+ - Top-scope with multiple assignment using split [\#550](https://github.com/rodjek/puppet-lint/issues/550)
11
+ - Strange error about indent with comments [\#475](https://github.com/rodjek/puppet-lint/issues/475)
12
+ - Hash of hashes with long keys causes irrational warnings and crashes --fix [\#424](https://github.com/rodjek/puppet-lint/issues/424)
13
+ - Wrong arrow alignment when key has interpolated variable [\#416](https://github.com/rodjek/puppet-lint/issues/416)
14
+ - indentation of =\> is not properly aligned in hash within array [\#333](https://github.com/rodjek/puppet-lint/issues/333)
15
+
16
+ **Merged pull requests:**
17
+
18
+ - Correctly handle strings-with-variables as hash keys in arrow\_alignment check [\#621](https://github.com/rodjek/puppet-lint/pull/621) ([rodjek](https://github.com/rodjek))
19
+ - Support array of variables on left side of an assign operation [\#617](https://github.com/rodjek/puppet-lint/pull/617) ([rodjek](https://github.com/rodjek))
20
+ - Test against Ruby 2.4.0 [\#616](https://github.com/rodjek/puppet-lint/pull/616) ([rodjek](https://github.com/rodjek))
21
+ - Calculate arrow column from first parameter position, not the start of the line [\#615](https://github.com/rodjek/puppet-lint/pull/615) ([rodjek](https://github.com/rodjek))
22
+ - Do not test against Ruby 2.2 [\#613](https://github.com/rodjek/puppet-lint/pull/613) ([ghoneycutt](https://github.com/ghoneycutt))
23
+
3
24
  ## [2.1.0](https://github.com/rodjek/puppet-lint/tree/2.1.0) (2016-12-30)
4
25
  [Full Changelog](https://github.com/rodjek/puppet-lint/compare/2.0.2...2.1.0)
5
26
 
6
27
  **Closed issues:**
7
28
 
8
- - No documentation on how to use plugins [\#602](https://github.com/rodjek/puppet-lint/issues/602)
9
29
  - Excessive number of warnings from code\_on\_top\_scope [\#579](https://github.com/rodjek/puppet-lint/issues/579)
10
30
  - Syntax error for references starting with Regexp [\#566](https://github.com/rodjek/puppet-lint/issues/566)
11
31
  - --fix flag discoverability is low [\#556](https://github.com/rodjek/puppet-lint/issues/556)
12
32
  - Module names must only contain lowercase letters [\#554](https://github.com/rodjek/puppet-lint/issues/554)
13
- - incorrect error on inline template [\#545](https://github.com/rodjek/puppet-lint/issues/545)
14
- - parameter\_order check does not work default hash is added in parameter [\#544](https://github.com/rodjek/puppet-lint/issues/544)
15
33
  - Remove formatting with `linenumber` [\#539](https://github.com/rodjek/puppet-lint/issues/539)
16
- - Incorrect warning of required parameter when using array that includes variable. [\#537](https://github.com/rodjek/puppet-lint/issues/537)
17
34
  - names\_containing\_dash is broken and unignorable [\#534](https://github.com/rodjek/puppet-lint/issues/534)
18
35
  - Puppet-lint 2.0 fails on unquoted string starting with underscore. [\#531](https://github.com/rodjek/puppet-lint/issues/531)
36
+ - puppet-lint reports incorrect line numbers [\#403](https://github.com/rodjek/puppet-lint/issues/403)
37
+ - Release version 2.1.0 [\#610](https://github.com/rodjek/puppet-lint/issues/610)
38
+ - No documentation on how to use plugins [\#602](https://github.com/rodjek/puppet-lint/issues/602)
39
+ - incorrect error on inline template [\#545](https://github.com/rodjek/puppet-lint/issues/545)
40
+ - parameter\_order check does not work default hash is added in parameter [\#544](https://github.com/rodjek/puppet-lint/issues/544)
41
+ - Incorrect warning of required parameter when using array that includes variable. [\#537](https://github.com/rodjek/puppet-lint/issues/537)
19
42
  - syntax error on valid file when: if /regex/ in array [\#517](https://github.com/rodjek/puppet-lint/issues/517)
20
43
  - crashes if there is a \# line:endignore with no begining. [\#509](https://github.com/rodjek/puppet-lint/issues/509)
21
44
  - Wrong behaviour of variable\_contains\_dash [\#504](https://github.com/rodjek/puppet-lint/issues/504)
22
- - puppet-lint reports incorrect line numbers [\#403](https://github.com/rodjek/puppet-lint/issues/403)
45
+ - Start a CHANGELOG, make updates part of the build workflow [\#479](https://github.com/rodjek/puppet-lint/issues/479)
46
+ - Nested future scope blocks lose local variables from parent scopes. [\#456](https://github.com/rodjek/puppet-lint/issues/456)
47
+ - block-local variables \(|$x|\) don't properly get recognized when used as arrays or hashes [\#450](https://github.com/rodjek/puppet-lint/issues/450)
23
48
  - lint ignore comments feature not documented [\#369](https://github.com/rodjek/puppet-lint/issues/369)
24
49
 
25
50
  **Merged pull requests:**
26
51
 
27
- - Documentation on plugin usage. [\#611](https://github.com/rodjek/puppet-lint/pull/611) ([rnelson0](https://github.com/rnelson0))
52
+ - 2.1.0 Release [\#612](https://github.com/rodjek/puppet-lint/pull/612) ([rnelson0](https://github.com/rnelson0))
28
53
  - Puppet-lint version bump to 2.1.0.pre [\#608](https://github.com/rodjek/puppet-lint/pull/608) ([rnelson0](https://github.com/rnelson0))
29
- - \(\#369\) Document existence of control comments [\#600](https://github.com/rodjek/puppet-lint/pull/600) ([rnelson0](https://github.com/rnelson0))
30
54
  - Ignore \*.pp files at the top level [\#597](https://github.com/rodjek/puppet-lint/pull/597) ([rnelson0](https://github.com/rnelson0))
31
55
  - Show logs in rspec tests [\#596](https://github.com/rodjek/puppet-lint/pull/596) ([ghoneycutt](https://github.com/ghoneycutt))
32
- - \(\#517\) Update the allowed tokens prior to a regex [\#594](https://github.com/rodjek/puppet-lint/pull/594) ([rnelson0](https://github.com/rnelson0))
33
- - \(\#531\) Treat barewords beginning with an underscore as :NAME tokens [\#593](https://github.com/rodjek/puppet-lint/pull/593) ([rnelson0](https://github.com/rnelson0))
34
- - \(\#544, \#537\) Skip hash contents when checking optional parameters [\#592](https://github.com/rodjek/puppet-lint/pull/592) ([rnelson0](https://github.com/rnelson0))
35
- - \(\#545\) Exempt inline\_epp and inline\_template from single quoted strin… [\#591](https://github.com/rodjek/puppet-lint/pull/591) ([rnelson0](https://github.com/rnelson0))
36
- - Disable code\_on\_top\_scope by default until the noise can be reduced \(… [\#590](https://github.com/rodjek/puppet-lint/pull/590) ([rnelson0](https://github.com/rnelson0))
37
- - Changelog generator task [\#589](https://github.com/rodjek/puppet-lint/pull/589) ([rnelson0](https://github.com/rnelson0))
38
56
  - Count lines in comments and double quoted strings [\#577](https://github.com/rodjek/puppet-lint/pull/577) ([paran1](https://github.com/paran1))
39
57
  - Handle mismatched control comments gracefully [\#573](https://github.com/rodjek/puppet-lint/pull/573) ([rodjek](https://github.com/rodjek))
40
58
  - Reimplementation of --fix support for unenclosed variables delimited by dashes [\#572](https://github.com/rodjek/puppet-lint/pull/572) ([rodjek](https://github.com/rodjek))
@@ -50,18 +68,23 @@
50
68
  - Updates PR for \#223 [\#552](https://github.com/rodjek/puppet-lint/pull/552) ([binford2k](https://github.com/binford2k))
51
69
  - add legacy\_facts [\#543](https://github.com/rodjek/puppet-lint/pull/543) ([mmckinst](https://github.com/mmckinst))
52
70
  - Remove formatting with `linenumber` [\#540](https://github.com/rodjek/puppet-lint/pull/540) ([rski](https://github.com/rski))
53
- - Adding support for logging to STDOUT as JSON [\#487](https://github.com/rodjek/puppet-lint/pull/487) ([binford2k](https://github.com/binford2k))
54
71
  - Potential README changes [\#420](https://github.com/rodjek/puppet-lint/pull/420) ([rothsa](https://github.com/rothsa))
55
72
  - Add fix to "ensure found on line but it's not the first attribute" [\#375](https://github.com/rodjek/puppet-lint/pull/375) ([sathieu](https://github.com/sathieu))
73
+ - Documentation on plugin usage. [\#611](https://github.com/rodjek/puppet-lint/pull/611) ([rnelson0](https://github.com/rnelson0))
74
+ - \(\#369\) Document existence of control comments [\#600](https://github.com/rodjek/puppet-lint/pull/600) ([rnelson0](https://github.com/rnelson0))
75
+ - \(\#517\) Update the allowed tokens prior to a regex [\#594](https://github.com/rodjek/puppet-lint/pull/594) ([rnelson0](https://github.com/rnelson0))
76
+ - \(\#531\) Treat barewords beginning with an underscore as :NAME tokens [\#593](https://github.com/rodjek/puppet-lint/pull/593) ([rnelson0](https://github.com/rnelson0))
77
+ - \(\#544, \#537\) Skip hash contents when checking optional parameters [\#592](https://github.com/rodjek/puppet-lint/pull/592) ([rnelson0](https://github.com/rnelson0))
78
+ - \(\#545\) Exempt inline\_epp and inline\_template from single quoted strin… [\#591](https://github.com/rodjek/puppet-lint/pull/591) ([rnelson0](https://github.com/rnelson0))
79
+ - Disable code\_on\_top\_scope by default until the noise can be reduced \(… [\#590](https://github.com/rodjek/puppet-lint/pull/590) ([rnelson0](https://github.com/rnelson0))
80
+ - Changelog generator task [\#589](https://github.com/rodjek/puppet-lint/pull/589) ([rnelson0](https://github.com/rnelson0))
81
+ - Adding support for logging to STDOUT as JSON [\#487](https://github.com/rodjek/puppet-lint/pull/487) ([binford2k](https://github.com/binford2k))
56
82
 
57
83
  ## [2.0.2](https://github.com/rodjek/puppet-lint/tree/2.0.2) (2016-08-19)
58
84
  [Full Changelog](https://github.com/rodjek/puppet-lint/compare/2.0.1...2.0.2)
59
85
 
60
86
  **Closed issues:**
61
87
 
62
- - Start a CHANGELOG, make updates part of the build workflow [\#479](https://github.com/rodjek/puppet-lint/issues/479)
63
- - Nested future scope blocks lose local variables from parent scopes. [\#456](https://github.com/rodjek/puppet-lint/issues/456)
64
- - block-local variables \(|$x|\) don't properly get recognized when used as arrays or hashes [\#450](https://github.com/rodjek/puppet-lint/issues/450)
65
88
  - Option to choose version of the puppet style guide [\#190](https://github.com/rodjek/puppet-lint/issues/190)
66
89
 
67
90
  **Merged pull requests:**
@@ -72,8 +95,6 @@
72
95
  ## [2.0.1](https://github.com/rodjek/puppet-lint/tree/2.0.1) (2016-08-18)
73
96
  [Full Changelog](https://github.com/rodjek/puppet-lint/compare/2.0.0...2.0.1)
74
97
 
75
- **Starting with v2.0.1, puppet-lint is deprecating support for Ruby 1.8.7.** Support will be removed in the next major release.
76
-
77
98
  **Closed issues:**
78
99
 
79
100
  - Changelog on Github pages is out of date [\#520](https://github.com/rodjek/puppet-lint/issues/520)
@@ -727,4 +748,4 @@ If the additional gems you use for checks are pinned to 1.x, you should pin pupp
727
748
  ## [0.0.1](https://github.com/rodjek/puppet-lint/tree/0.0.1) (2011-08-15)
728
749
 
729
750
 
730
- \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
751
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
@@ -309,6 +309,16 @@ class PuppetLint
309
309
  end
310
310
 
311
311
  @column += length
312
+
313
+ # If creating a :VARIABLE token inside a double quoted string, add 3 to
314
+ # the column state in order to account for the ${} characters when
315
+ # rendering out to manifest.
316
+ if token.type == :VARIABLE
317
+ if !token.prev_code_token.nil? && [:DQPRE, :DQMID].include?(token.prev_code_token.type)
318
+ @column += 3
319
+ end
320
+ end
321
+
312
322
  if type == :NEWLINE
313
323
  @line_no += 1
314
324
  @column = 1
@@ -298,17 +298,27 @@ PuppetLint.new_check(:variable_scope) do
298
298
  temp_scope_vars = []
299
299
 
300
300
  object_tokens.each do |token|
301
- if token.type == :VARIABLE
301
+ case token.type
302
+ when :EQUALS
303
+ if token.prev_code_token.type == :VARIABLE
304
+ variables_in_scope << token.prev_code_token.value
305
+ elsif token.prev_code_token.type == :RBRACK
306
+ temp_token = token.prev_code_token
307
+
308
+ until temp_token.type == :LBRACK do
309
+ if temp_token.type == :VARIABLE
310
+ variables_in_scope << temp_token.value
311
+ end
312
+ temp_token = temp_token.prev_code_token
313
+ end
314
+ end
315
+ when :VARIABLE
302
316
  if in_pipe
303
317
  temp_scope_vars << token.value
304
318
  else
305
- if token.next_code_token.type == :EQUALS
306
- variables_in_scope << token.value
307
- else
308
- referenced_variables << token
309
- end
319
+ referenced_variables << token
310
320
  end
311
- elsif token.type == :PIPE
321
+ when :PIPE
312
322
  in_pipe = !in_pipe
313
323
 
314
324
  if in_pipe
@@ -128,6 +128,7 @@ PuppetLint.new_check(:arrow_alignment) do
128
128
  indent_depth = [0]
129
129
  indent_depth_idx = 0
130
130
  level_tokens = []
131
+ param_column = [nil]
131
132
  resource_tokens = res_idx[:tokens]
132
133
  resource_tokens.reject! do |token|
133
134
  COMMENT_TYPES.include? token.type
@@ -143,9 +144,29 @@ PuppetLint.new_check(:arrow_alignment) do
143
144
  resource_tokens.each_with_index do |token, idx|
144
145
  if token.type == :FARROW
145
146
  (level_tokens[indent_depth_idx] ||= []) << token
146
- prev_indent_token = resource_tokens[0..idx].rindex { |t| t.type == :INDENT }
147
- indent_token_length = prev_indent_token.nil? ? 0 : resource_tokens[prev_indent_token].to_manifest.length
148
- indent_length = indent_token_length + token.prev_code_token.to_manifest.length + 2
147
+ param_token = token.prev_code_token
148
+
149
+ if param_token.type == :DQPOST
150
+ param_length = 0
151
+ iter_token = param_token
152
+ while iter_token.type != :DQPRE do
153
+ param_length += iter_token.to_manifest.length
154
+ iter_token = iter_token.prev_token
155
+ end
156
+ param_length += iter_token.to_manifest.length
157
+ else
158
+ param_length = param_token.to_manifest.length
159
+ end
160
+
161
+ if param_column[indent_depth_idx].nil?
162
+ if param_token.type == :DQPOST
163
+ param_column[indent_depth_idx] = iter_token.column
164
+ else
165
+ param_column[indent_depth_idx] = param_token.column
166
+ end
167
+ end
168
+
169
+ indent_length = param_column[indent_depth_idx] + param_length + 1
149
170
 
150
171
  if indent_depth[indent_depth_idx] < indent_length
151
172
  indent_depth[indent_depth_idx] = indent_length
@@ -155,6 +176,7 @@ PuppetLint.new_check(:arrow_alignment) do
155
176
  indent_depth_idx += 1
156
177
  indent_depth << 0
157
178
  level_tokens[indent_depth_idx] ||= []
179
+ param_column << nil
158
180
  elsif token.type == :RBRACE || token.type == :SEMIC
159
181
  level_tokens[indent_depth_idx].each do |arrow_tok|
160
182
  unless arrow_tok.column == indent_depth[indent_depth_idx] || level_tokens[indent_depth_idx].size == 1
@@ -166,7 +188,7 @@ PuppetLint.new_check(:arrow_alignment) do
166
188
  :token => arrow_tok,
167
189
  :indent_depth => indent_depth[indent_depth_idx],
168
190
  :newline => !(arrows_on_line.index(arrow_tok) == 0),
169
- :newline_indent => arrows_on_line.first.prev_code_token.prev_token.value,
191
+ :newline_indent => param_column[indent_depth_idx] - 1,
170
192
  }
171
193
  end
172
194
  end
@@ -179,7 +201,19 @@ PuppetLint.new_check(:arrow_alignment) do
179
201
  end
180
202
 
181
203
  def fix(problem)
182
- new_ws_len = (problem[:indent_depth] - (problem[:newline_indent].length + problem[:token].prev_code_token.to_manifest.length + 1))
204
+ param_token = problem[:token].prev_code_token
205
+ if param_token.type == :DQPOST
206
+ param_length = 0
207
+ iter_token = param_token
208
+ while iter_token.type != :DQPRE do
209
+ param_length += iter_token.to_manifest.length
210
+ iter_token = iter_token.prev_token
211
+ end
212
+ param_length += iter_token.to_manifest.length
213
+ else
214
+ param_length = param_token.to_manifest.length
215
+ end
216
+ new_ws_len = (problem[:indent_depth] - (problem[:newline_indent] + param_length + 1))
183
217
  new_ws = ' ' * new_ws_len
184
218
  if problem[:newline]
185
219
  index = tokens.index(problem[:token].prev_code_token.prev_token)
@@ -189,7 +223,7 @@ PuppetLint.new_check(:arrow_alignment) do
189
223
 
190
224
  # indent the parameter to the correct depth
191
225
  problem[:token].prev_code_token.prev_token.type = :INDENT
192
- problem[:token].prev_code_token.prev_token.value = problem[:newline_indent].dup
226
+ problem[:token].prev_code_token.prev_token.value = ' ' * problem[:newline_indent]
193
227
  end
194
228
 
195
229
  if problem[:token].prev_token.type == :WHITESPACE
@@ -1,3 +1,3 @@
1
1
  class PuppetLint
2
- VERSION = '2.1.0'
2
+ VERSION = '2.1.1'
3
3
  end
@@ -516,6 +516,12 @@ describe PuppetLint::Lexer do
516
516
  expect(tokens[2].line).to eq(1)
517
517
  expect(tokens[2].column).to eq(6)
518
518
  end
519
+
520
+ it 'should calculate the column number correctly after an enclosed variable' do
521
+ token = @lexer.tokenise(' "${foo}" =>').last
522
+ expect(token.type).to eq(:FARROW)
523
+ expect(token.column).to eq(12)
524
+ end
519
525
  end
520
526
 
521
527
  [
@@ -196,4 +196,16 @@ describe 'variable_scope' do
196
196
  expect(problems).to have(0).problems
197
197
  end
198
198
  end
199
+
200
+ context 'multiple left hand variable assign' do
201
+ let(:code) { "
202
+ class test {
203
+ [$foo, $bar] = something()
204
+ }
205
+ " }
206
+
207
+ it 'should not detect any problems' do
208
+ expect(problems).to have(0).problems
209
+ end
210
+ end
199
211
  end
@@ -332,6 +332,76 @@ describe 'arrow_alignment' do
332
332
  end
333
333
  end
334
334
 
335
+ context 'multiline hash with opening brace on same line as first pair' do
336
+ let(:code) { "
337
+ foo { 'foo':
338
+ bar => [
339
+ { aa => bb,
340
+ c => d},
341
+ ],
342
+ }
343
+ " }
344
+
345
+ it 'should not detect any problems' do
346
+ expect(problems).to have(0).problems
347
+ end
348
+ end
349
+
350
+ context 'unaligned multiline hash with opening brace on the same line as the first pair' do
351
+ let(:code) { "
352
+ foo { 'foo':
353
+ bar => [
354
+ { aa => bb,
355
+ c => d},
356
+ ],
357
+ }
358
+ " }
359
+
360
+ it 'should detect one problem' do
361
+ expect(problems).to have(1).problem
362
+ end
363
+
364
+ it 'should create one warning' do
365
+ expect(problems).to contain_warning(sprintf(msg,18,17)).on_line(5).in_column(17)
366
+ end
367
+ end
368
+
369
+ context 'hash with strings containing variables as keys properly aligned' do
370
+ let(:code) { '
371
+ foo { foo:
372
+ param => {
373
+ a => 1
374
+ "${aoeu}" => 2,
375
+ b => 3,
376
+ },
377
+ }
378
+ ' }
379
+
380
+ it 'should not detect any problems' do
381
+ expect(problems).to have(0).problems
382
+ end
383
+ end
384
+
385
+ context 'hash with strings containing variables as keys incorrectly aligned' do
386
+ let(:code) { '
387
+ foo { foo:
388
+ param => {
389
+ a => 1
390
+ "${aoeu}" => 2,
391
+ b => 3,
392
+ },
393
+ }
394
+ ' }
395
+
396
+ it 'should detect 2 problems' do
397
+ expect(problems).to have(2).problems
398
+ end
399
+
400
+ it 'should create 2 warnings' do
401
+ expect(problems).to contain_warning(sprintf(msg,23,15)).on_line(4).in_column(15)
402
+ expect(problems).to contain_warning(sprintf(msg,23,19)).on_line(6).in_column(19)
403
+ end
404
+ end
335
405
  end
336
406
 
337
407
  context 'with fix enabled' do
@@ -570,5 +640,40 @@ describe 'arrow_alignment' do
570
640
  expect(manifest).to eq(fixed)
571
641
  end
572
642
  end
643
+
644
+ context 'hash with strings containing variables as keys incorrectly aligned' do
645
+ let(:code) { '
646
+ foo { foo:
647
+ param => {
648
+ a => 1
649
+ "${aoeu}" => 2,
650
+ b => 3,
651
+ },
652
+ }
653
+ ' }
654
+ let(:fixed) { '
655
+ foo { foo:
656
+ param => {
657
+ a => 1
658
+ "${aoeu}" => 2,
659
+ b => 3,
660
+ },
661
+ }
662
+ ' }
663
+
664
+
665
+ it 'should detect 2 problems' do
666
+ expect(problems).to have(2).problems
667
+ end
668
+
669
+ it 'should fix 2 problems' do
670
+ expect(problems).to contain_fixed(sprintf(msg,23,15)).on_line(4).in_column(15)
671
+ expect(problems).to contain_fixed(sprintf(msg,23,19)).on_line(6).in_column(19)
672
+ end
673
+
674
+ it 'should align the hash rockets' do
675
+ expect(manifest).to eq(fixed)
676
+ end
677
+ end
573
678
  end
574
679
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Sharpe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-30 00:00:00.000000000 Z
11
+ date: 2017-02-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  Checks your Puppet manifests against the Puppetlabs
@@ -19,9 +19,9 @@ executables:
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
- - .gitignore
23
- - .rspec
24
- - .travis.yml
22
+ - ".gitignore"
23
+ - ".rspec"
24
+ - ".travis.yml"
25
25
  - CHANGELOG.md
26
26
  - Gemfile
27
27
  - LICENSE
@@ -115,17 +115,17 @@ require_paths:
115
115
  - lib
116
116
  required_ruby_version: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - '>='
118
+ - - ">="
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - '>='
123
+ - - ">="
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.0.14
128
+ rubygems_version: 2.6.10
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: Ensure your Puppet manifests conform with the Puppetlabs style guide