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.
Describe the Bug
The repair (
--fix
) foronly_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:
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
puppet-lint (4.2.4)