Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"only_variable_string" repair breaks code which relies on stringification of non-primitive types: #209

Open
zbentley opened this issue Jun 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@zbentley
Copy link

zbentley commented Jun 21, 2024

Describe the Bug

The repair (--fix) for only_variable_string changes the behavior of code when implicit stringification of non-primitive types is used.

Expected Behavior

When Puppet code casts a variable to a string by enclosing it in quotes, puppet-lint should only decide those quotes are unnecessary if removing them doesn't risk removing implicit stringification/cast behavior.

Steps to Reproduce

Run the following Puppet code through puppet-lint:

$version = SemVer('3.12.4')
notify { "$version":}

Observe that puppet-lint reformats the code to be notify { $version:} which fails to compile since $version is not a string and names can only be strings.

Environment

  • Version puppet-lint (4.2.4)
  • MacOS 14, Ruby 3.3.3.
@zbentley zbentley added the bug Something isn't working label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant