-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Error fixing indent for variable in possion 0 #4
Comments
I have created a fix for this but my Ruby foo isn't that good... |
fixed in 84f039f |
Thanks |
A follow up to this I noted at the same time the line numbers are reported incorrectly. |
thanks, i'll look into it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I original raised this issue with the puppet-lint code but its actually with this plug in instead
[https://github.com/rodjek/puppet-lint/issues/489](puppet-lint issue 489)
I am having an issue where if i let lint fix an error like "WARNING: indent should be 2 chars and is 0 on line 1" it tends to fix it incorrectly as it adds the 2 chars at possession 1 instead of 0.
I have done some extra digging and this seems to be because the way tokens of type "VARIABLE" work, there value is the name of the variable with out the $ (this seems logical). so in this case adding indent to the token.value will not work. Seems you would have to add a new token of type WHITESPACE instead
Example of bug
=== Original file ===
class agent(
$group = "",
$server = "",
$serial = "",
$service_name = "",
$server_ip = "",
$version = "",
$enabled = true,
){
=== Fixed file ===
class agent(
$ group = '',
$ server = '',
$ serial = '',
$ service_name = '',
$ server_ip = '',
$ version = '',
$ enabled = true,
){
== Example runs ==
$ puppet-lint init.pp
./manifests/init.pp - WARNING: indent should be 2 chars and is 0 on line 1
./manifests/init.pp - WARNING: indent should be 2 chars and is 0 on line 2
./manifests/init.pp - WARNING: indent should be 2 chars and is 0 on line 3
./manifests/init.pp - WARNING: indent should be 2 chars and is 0 on line 4
./manifests/init.pp - WARNING: indent should be 2 chars and is 0 on line 5
./manifests/init.pp - WARNING: indent should be 2 chars and is 0 on line 6
./manifests/init.pp - WARNING: indent should be 2 chars and is 0 on line 7
$ puppet-lint -f init.pp
./manifests/init.pp - FIXED: indent should be 2 chars and is 0 on line 1
./manifests/init.pp - FIXED: indent should be 2 chars and is 0 on line 2
./manifests/init.pp - FIXED: indent should be 2 chars and is 0 on line 3
./manifests/init.pp - FIXED: indent should be 2 chars and is 0 on line 4
./manifests/init.pp - FIXED: indent should be 2 chars and is 0 on line 5
./manifests/init.pp - FIXED: indent should be 2 chars and is 0 on line 6
./manifests/init.pp - FIXED: indent should be 2 chars and is 0 on line 7
The text was updated successfully, but these errors were encountered: