Open traylenator opened 4 years ago
this behavior is intentional
this behavior is intentional
That's a shame. IMO, it's not correct and conflicts with what other tools do. eg. vim-puppet's indentation.
It's not just a puppet thing, eg ruby and rubocop.
Puppet code following the rules from this plugin.
$a = [{
foo => bar,
}]
Almost identical ruby code following same style.
a = [{
foo: 'bar'
}]
Layout/FirstHashElementIndentation: Use 2 spaces for indentation in a hash, relative to the start of the line where the left curly brace is.
this behavior is intentional
That's a shame. IMO, it's not correct and conflicts with what other tools do.
I agree. When I wrote this plugin I had to choose how to indent for these cases:
$content = epp(
'file.epp',{
'options' => '124',
})
$content = epp('file.epp',{
'options' => '124',
}
)
This plugin does not assert that multiple brackets in a single line must also be closed in a single line, so the simpler code implementation was to increase or decrease indent for every bracket.
I no longer write new code for this plugin, but I will reopen this issue and mark it as help wanted
.
If someone wants to implement a fix for this issue, I will publish it as a major version bump, and the following indents should all be valid:
$content = epp('file.epp',{
'options' => '124',
})
$content = epp(
'file.epp',{
'options' => '124',
})
$content = epp('file.epp',{
'options' => '124',
}
)
With the following
gives.
this seems wrong to me.
Maybe it should be rewritten as
but the first seems valid to me.