rodjek / puppet-lint

Check that your Puppet manifests conform to the style guide
MIT License
819 stars 204 forks source link

Syntax error when using Unicode characters in heredoc #946

Open Martin8412 opened 3 years ago

Martin8412 commented 3 years ago

After upgrading from puppet-lint from 2.3.6 to 2.4.0 we've started experiencing issues with Unicode characters in non-interpolated heredoc blocks of text. This also happens in 2.4.2.

To reproduce the issue, here is a simplified example that will cause a syntax error

define foo  {
  $content1 = @(EOT)
  😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀😀
  | EOT

  $content2 = @(EOT)
  🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂
  | EOT

  $content3 = @(EOT)
  ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
  | EOT
}

Here is the result of linting it

$ puppet-lint --fail-on-warnings --no-documentation-check --no-autoloader_layout-check --no-parameter_order-check --no-140chars-check --no-unquoted_node_name-check test.pp

ERROR: Syntax error on line 4
Try running `puppet parser validate <file>`

If we use single quotes instead of a heredoc it doesn't cause a syntax error.