puppet-lint 2.2.0 → 2.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d618e442c08c4d3e79853fc370348c9ee8e8970
4
- data.tar.gz: 82099093c21a374e137a39bd0323443e16015e95
3
+ metadata.gz: d38c3e980312a05a89ce9927adb0f804a9bb2b3a
4
+ data.tar.gz: 9ed350e5a31848d582093b528b516c8834250bd8
5
5
  SHA512:
6
- metadata.gz: 179cd2b6f7ada144261bf630064a4ca26a212d3693fba9244a9a4fbd2b8c75ec78f6935f50175845bf2d743e53671f19c683e9e5ccb14b950e7d6e9e86c269d4
7
- data.tar.gz: 8d5f9a973d53c47e8ce6a7caac88c4aa8ab7637e95221e95676b7adf40b8cc8c2ed9b615d09f19857aeadbc36d7629d86518ba644fbaf08845050ae2c2018201
6
+ metadata.gz: 29ed416ab704c80e28e01fff7c024fb92406a5dc091f2ebbd4e247b214b49560aca37e71e03730adfd71846f08c8396122fc4e30d043881e20434a920b43d6ac
7
+ data.tar.gz: dbf341808a24b94dbaa7e1b01145832b5995f7c197fa651300aac7e38bdb5f688c6f1b57271b9496648bf9604788a278cb522e3679d3e4e4a669b0bfafb85123
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Change Log
2
2
 
3
+ ## [2.2.1](https://github.com/rodjek/puppet-lint/tree/2.2.1) (2017-03-29)
4
+ [Full Changelog](https://github.com/rodjek/puppet-lint/compare/2.2.0...2.2.1)
5
+
6
+ **Closed issues:**
7
+
8
+ - "undefined method `map' for nil:NilClass" when running check\_whitespace [\#681](https://github.com/rodjek/puppet-lint/issues/681)
9
+ - "undefined method `next\_token='" when fixing with check\_whitespace [\#680](https://github.com/rodjek/puppet-lint/issues/680)
10
+ - Release 2.2.0 planning and discussion [\#668](https://github.com/rodjek/puppet-lint/issues/668)
11
+
12
+ **Merged pull requests:**
13
+
14
+ - restore the links between tokens after arrow\_on\_right\_operand\_line\#fix [\#684](https://github.com/rodjek/puppet-lint/pull/684) ([rodjek](https://github.com/rodjek))
15
+ - level\_tokens\[0\] can be nil if there is no params in the top level block [\#682](https://github.com/rodjek/puppet-lint/pull/682) ([rodjek](https://github.com/rodjek))
16
+
3
17
  ## [2.2.0](https://github.com/rodjek/puppet-lint/tree/2.2.0) (2017-03-29)
4
18
  [Full Changelog](https://github.com/rodjek/puppet-lint/compare/2.1.1...2.2.0)
5
19
 
@@ -75,7 +89,6 @@
75
89
 
76
90
  **Merged pull requests:**
77
91
 
78
- - puppet-lint 2.1.1 release [\#628](https://github.com/rodjek/puppet-lint/pull/628) ([rnelson0](https://github.com/rnelson0))
79
92
  - 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))
80
93
  - 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))
81
94
  - Test against Ruby 2.4.0 [\#616](https://github.com/rodjek/puppet-lint/pull/616) ([rodjek](https://github.com/rodjek))
@@ -242,6 +255,25 @@
242
255
  ## [2.0.0](https://github.com/rodjek/puppet-lint/tree/2.0.0) (2016-06-22)
243
256
  [Full Changelog](https://github.com/rodjek/puppet-lint/compare/1.1.0...2.0.0)
244
257
 
258
+ puppet-lint 2.0.0 is a breaking change. Specifically, the renaming of the line length test was changed from `80chars` to `140chars`. You may need to adjust your configuration and lint checks. For example:
259
+ ```ruby
260
+ # Line length test is 80 chars in puppet-lint 1.1.0
261
+ PuppetLint.configuration.send('disable_80chars')
262
+ # Line length test is 140 chars in puppet-lint 2.x
263
+ PuppetLint.configuration.send('disable_140chars')
264
+ ```
265
+
266
+ You may also need to adjust your Gemfile if you are pointing directly at git:
267
+ ```ruby
268
+ # old
269
+ gem 'puppet-lint', :require => false, :git => 'https://github.com/rodjek/puppet-lint.git'
270
+
271
+ # new
272
+ gem 'puppet-lint', '~> 2.0'
273
+ ```
274
+
275
+ If the additional gems you use for checks are pinned to 1.x, you should pin puppet-lint to `'~> 1.0'` or `'>= 1.0', '< 3.0'` until updated check gems are released.
276
+
245
277
  **Closed issues:**
246
278
 
247
279
  - Current package [\#471](https://github.com/rodjek/puppet-lint/issues/471)
@@ -109,7 +109,7 @@ class PuppetLint::Data
109
109
  marker = 0
110
110
  result = []
111
111
  tokens.select { |t| t.type == :COLON }.each do |colon_token|
112
- if colon_token.next_code_token && colon_token.next_code_token != :LBRACE
112
+ if colon_token.next_code_token && colon_token.next_code_token.type != :LBRACE
113
113
  start_idx = tokens.index(colon_token)
114
114
  next if start_idx < marker
115
115
  end_token = colon_token.next_token_of([:SEMIC, :RBRACE])
@@ -35,6 +35,7 @@ PuppetLint.new_check(:arrow_on_right_operand_line) do
35
35
  def fix(problem)
36
36
  token = problem[:token]
37
37
  tokens.delete(token)
38
+
38
39
  # remove any excessive whitespace on the line
39
40
  temp_token = token.prev_code_token
40
41
  while (temp_token = temp_token.next_token)
@@ -42,9 +43,17 @@ PuppetLint.new_check(:arrow_on_right_operand_line) do
42
43
  break if temp_token.type == :NEWLINE
43
44
  end
44
45
 
46
+ temp_token.next_token = token
47
+ token.prev_token = temp_token
45
48
  index = tokens.index(token.next_code_token)
46
49
  tokens.insert(index, token)
47
- tokens.insert(index + 1, PuppetLint::Lexer::Token.new(:WHITESPACE, ' ', 0, 0))
50
+
51
+ whitespace_token = PuppetLint::Lexer::Token.new(:WHITESPACE, ' ', temp_token.line + 1, 3)
52
+ whitespace_token.prev_token = token
53
+ token.next_token = whitespace_token
54
+ whitespace_token.next_token = tokens[index + 1]
55
+ tokens[index + 1].prev_token = whitespace_token
56
+ tokens.insert(index + 1, whitespace_token)
48
57
  end
49
58
 
50
59
  def whitespace?(token)
@@ -178,7 +178,7 @@ PuppetLint.new_check(:arrow_alignment) do
178
178
  level_tokens[level_idx] ||= []
179
179
  param_column << nil
180
180
  elsif token.type == :RBRACE || token.type == :SEMIC
181
- if level_tokens[level_idx].map(&:line).uniq.length > 1
181
+ if (level_tokens[level_idx] ||= []).map(&:line).uniq.length > 1
182
182
  level_tokens[level_idx].each do |arrow_tok|
183
183
  unless arrow_tok.column == arrow_column[level_idx] || level_tokens[level_idx].size == 1
184
184
  arrows_on_line = level_tokens[level_idx].select { |t| t.line == arrow_tok.line }
@@ -1,3 +1,3 @@
1
1
  class PuppetLint
2
- VERSION = '2.2.0'
2
+ VERSION = '2.2.1'
3
3
  end
@@ -424,6 +424,23 @@ describe 'arrow_alignment' do
424
424
  expect(problems).to have(0).problems
425
425
  end
426
426
  end
427
+
428
+ context 'where the top level of the block has no parameters' do
429
+ let(:code) { "
430
+ case $::osfamily {
431
+ 'RedHat': {
432
+ $datadir = $::operatingsystem ? {
433
+ 'Amazon' => pick($datadir, 'value'),
434
+ default => pick($datadir, 'value'),
435
+ }
436
+ }
437
+ }
438
+ " }
439
+
440
+ it 'should not detect any problems' do
441
+ expect(problems).to have(0).problems
442
+ end
443
+ end
427
444
  end
428
445
 
429
446
  context 'with fix enabled' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Sharpe