puppet-lint 2.4.0 → 2.4.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
  SHA256:
3
- metadata.gz: b67dfbcf1aff9be2449b52eb8ff66db18cf025ad69ce6dee4f3e8a7ae4155980
4
- data.tar.gz: 2eec8d5d37d1deeaaf9e26ca6ad24e7f841e137bb9de99e61736675862f6bffc
3
+ metadata.gz: f5218ad907f8d7979c11e6275ee5747650d18ab7586ce531f8628d5a493f99ae
4
+ data.tar.gz: 521f517cf4f8cdb13a633ecb0498c3dfe23566e3584a7299950c9f8b22af44c9
5
5
  SHA512:
6
- metadata.gz: 80e81796c7aa00827859e45f6586105bbeb1c16c5a813e3130e8ff1fa11272c012dd86563d21172862a00852f49c0b0df2015881c83e15b62e208e117c85e938
7
- data.tar.gz: f21481a188185489015c3fa7dff8bd3d00e5eec505a547abc4c7633805c41e275f311eec37f5c4a93899ea77fb43a530ba25588fdbb0f78dc043f904d6716c1b
6
+ metadata.gz: fea7721ce15f702e1e66fb153724f6a27af58a9f44bb0dede58cda9582d0c63729f76cff5cbc48ff0a8784515f8a10bceb196b8c887791b8bbfaecfcd7338377
7
+ data.tar.gz: 2021cdd71199fe62955b5f940545a8f84a124ccd9ab096b24eda2e13c8a5787f545235fcf7db9426dd4020503c59bc647259126dc9d14641ab1cd09d4a4e8aaf
@@ -1,5 +1,19 @@
1
1
  # Change Log
2
2
 
3
+ ## [2.4.1](https://github.com/rodjek/puppet-lint/tree/2.4.1) (2019-10-09)
4
+ [Full Changelog](https://github.com/rodjek/puppet-lint/compare/2.4.0...2.4.1)
5
+
6
+ **Fixed bugs:**
7
+
8
+ - Puppet-lint 2.4.0 - ERROR: Syntax error on line x [\#887](https://github.com/rodjek/puppet-lint/issues/887)
9
+ - Puppet-lint 2.4.0 throws misleading warning on double-quoted strings with escaped variables [\#886](https://github.com/rodjek/puppet-lint/issues/886)
10
+ - Breaks after 2.4.0 upgrade [\#885](https://github.com/rodjek/puppet-lint/issues/885)
11
+
12
+ **Merged pull requests:**
13
+
14
+ - Fix escaped ${} enclosure handling when slurping double quoted strings [\#889](https://github.com/rodjek/puppet-lint/pull/889) ([rodjek](https://github.com/rodjek))
15
+ - Fix non-indented heredoc parsing [\#888](https://github.com/rodjek/puppet-lint/pull/888) ([rodjek](https://github.com/rodjek))
16
+
3
17
  ## [2.4.0](https://github.com/rodjek/puppet-lint/tree/2.4.0) (2019-10-08)
4
18
  [Full Changelog](https://github.com/rodjek/puppet-lint/compare/2.3.6...2.4.0)
5
19
 
@@ -241,7 +241,7 @@ class PuppetLint
241
241
  process_string_segments(string_segments)
242
242
  length = slurper.consumed_bytes + 1
243
243
  rescue PuppetLint::Lexer::StringSlurper::UnterminatedStringError
244
- raise PuppetLint::LexerError, @line_no, @column, 'unterminated string'
244
+ raise PuppetLint::LexerError.new(@line_no, @column, 'unterminated string')
245
245
  end
246
246
 
247
247
  elsif heredoc_name = chunk[%r{\A@\(("?.+?"?(:.+?)?#{WHITESPACE_RE}*(/.*?)?)\)}, 1]
@@ -293,6 +293,14 @@ class PuppetLint
293
293
  length = eol.size
294
294
  tokens << new_token(:NEWLINE, eol)
295
295
 
296
+ unless heredoc_queue.empty?
297
+ heredoc_tag = heredoc_queue.shift
298
+ slurper = PuppetLint::Lexer::StringSlurper.new(code[i + length..-1])
299
+ heredoc_segments = slurper.parse_heredoc(heredoc_tag)
300
+ process_heredoc_segments(heredoc_segments)
301
+ length += slurper.consumed_bytes
302
+ end
303
+
296
304
  elsif chunk.start_with?('/')
297
305
  length = 1
298
306
  tokens << new_token(:DIV, '/')
@@ -103,6 +103,11 @@ class PuppetLint
103
103
  end
104
104
 
105
105
  def start_interp
106
+ if @segment.last && @segment.last == '\\'
107
+ read_char
108
+ return
109
+ end
110
+
106
111
  if interp_stack.empty?
107
112
  scanner.skip(START_INTERP_PATTERN)
108
113
  results << [@segment_type, @segment.join]
@@ -1,3 +1,3 @@
1
1
  class PuppetLint
2
- VERSION = '2.4.0'.freeze
2
+ VERSION = '2.4.1'.freeze
3
3
  end
@@ -36,14 +36,22 @@ describe PuppetLint::Lexer::StringSlurper do
36
36
  end
37
37
  end
38
38
 
39
- context 'an escaped $' do
39
+ context 'an escaped $var' do
40
40
  let(:string) { '\$foo"' }
41
41
 
42
- it 'does not create an interpolation segment' do
42
+ it 'does not create an unenclosed variable segment' do
43
43
  expect(segments).to eq([[:STRING, '\$foo']])
44
44
  end
45
45
  end
46
46
 
47
+ context 'an escaped ${} enclosure' do
48
+ let(:string) { '\"\${\"string\"}\""' }
49
+
50
+ it 'does not create an interpolation segment' do
51
+ expect(segments).to eq([[:STRING, '\"\${\"string\"}\"']])
52
+ end
53
+ end
54
+
47
55
  context 'a variable and a suffix' do
48
56
  let(:string) { '${foo}bar"' }
49
57
 
@@ -1590,6 +1590,21 @@ END
1590
1590
  expect(tokens[6].type).to eq(:HEREDOC)
1591
1591
  expect(tokens[6].value).to eq(" foo\n ")
1592
1592
  end
1593
+
1594
+ it 'should handle a heredoc with no indentation' do
1595
+ manifest = <<-END.gsub(%r{^ {6}}, '')
1596
+ $str = @(EOT)
1597
+ something
1598
+ EOT
1599
+ END
1600
+ tokens = @lexer.tokenise(manifest)
1601
+
1602
+ expect(tokens.length).to eq(8)
1603
+ expect(tokens[4].type).to eq(:HEREDOC_OPEN)
1604
+ expect(tokens[4].value).to eq('EOT')
1605
+ expect(tokens[6].type).to eq(:HEREDOC)
1606
+ expect(tokens[6].value).to eq('something')
1607
+ end
1593
1608
  end
1594
1609
 
1595
1610
  context ':HEREDOC with interpolation' do
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.4.0
4
+ version: 2.4.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: 2019-10-08 00:00:00.000000000 Z
11
+ date: 2019-10-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  Checks your Puppet manifests against the Puppetlabs