rodjek/puppet-lint — pull request #217 by rodjek (2013-09-14 05:08:51+00:00)
Title: Bad hash indenting with --fix where members declared on a single line

Hi Tim,

I've had a go using --fix with puppet-lint at tag 0.4.0.pre1 and run into a problem with formatting hashes.

Sample input
```puppet
include mymodule
mymodule::do_thing { 'some thing':
whatever => { foo => 'bar', one => 'two' },
}
```
Running puppet-lint --fix test.pp elicits a single fix:
```
FIXED: indentation of => is not properly aligned on line 3
```

A diff of the original against the modified file:
```diff
--- test.pp.orig	2013-08-28 11:05:25.045150144 +1000
+++ test.pp	2013-08-28 11:05:37.481150615 +1000
@@ -1,4 +1,4 @@
include mymodule
mymodule::do_thing { 'some thing':
- whatever => { foo => 'bar', one => 'two' },
+ whatever => { foo => 'bar', one => 'two' },
}
```

If the hash is well formatted to begin with there is no change.

The problem also exhibited in a simpler test case

```puppet
include mymodule
mymodule::do_thing { 'some thing':
foo => 'bar', one => 'two',
}
```

```diff
--- test3.pp.orig	2013-08-28 11:11:37.561164255 +1000
+++ test3.pp	2013-08-28 11:11:47.565164634 +1000
@@ -1,4 +1,4 @@
include mymodule
mymodule::do_thing { 'some thing':
- foo => 'bar', one => 'two',
+ foo => 'bar', one => 'two',
}
```

I think plugins/check_whitespace.rb is attempting to catch this case.
```
108 # If this is a single line resource, skip it
109 next if resource_tokens.select { |r| r.type == :NEWLINE }.empty?
```

Sorry can't provide a patch at this stage.