Closed relud closed 8 years ago
what I get === Original file ===
# doc class agent( $group = '', ){ }
== Example run ==
$ puppet-lint init.pp ERROR: agent not in autoload module layout on line 2 WARNING: indent should be 2 chars and is 0 on line 3
closing worksforme
Can you re-open the issue? It seems that line number is reported incorrectly:
=== Original file ===
# doc
class agent(
$group = '',
){
}
== Example run ==
$ puppet-lint --only-checks strict_indent file.pp
WARNING: indent should be 2 chars and is 0 on line 3
Interesting thing - when I run puppet-lint -f on this file it's being fixed correctly.
From what I can see in the code, using token.next_token
in notify for line number and column should fix the issue.
line 3 is $group = '',
, which is the one that's incorrectly indented
I'm really sorry - wrong c&p:
$ nl file.pp
1 # doc
2 class agent(
3 $group = '',
4 ){
5 }
$ puppet-lint --only-checks strict_indent --with-context file.pp
WARNING: indent should be 2 chars and is 0 on line 2
class agent(
^
I have the same issue with the following file:
$ nl file2.pp
1 class some_claas(
2 $param
3 ){
4 some::resource { 'dummy':
5 param => $param,
6 }
7 }
$ puppet-lint --only-checks strict_indent --with-context file2.pp
WARNING: indent should be 2 chars and is 4 on line 3
){
^
WARNING: indent should be 4 chars and is 6 on line 4
some::resource { 'dummy':
^
WARNING: indent should be 2 chars and is 4 on line 5
param => $param,
^
could you give me your include puppet-lint version and ruby version for testing
$ bundle exec ruby --version
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
$ bundle exec gem list
*** LOCAL GEMS ***
bundler (1.12.5)
puppet-lint (2.0.2)
puppet-lint-strict_indent-check (2.0.3)
Tested also on
ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux-gnu]
Thank you for creating this plug-in. Line number is off by one on all my files
ERROR: agent not in autoload module layout on line 2 WARNING: indent should be 2 chars and is 0 on line 2
$ nl a.pp
1 # doc
2 class agent(
3 $group = '',
4 ){
5 }
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
puppet-lint (2.0.2, 2.0.0, 1.1.0)
puppet-lint-strict_indent-check (2.0.3)
thanks for the reports, i've been able to locate the source of the issue. token.line for a newline token changed from puppet-lint 1.0.1 to 1.1.0, causing this issue. I'll be releasing an updated gem to fix it.
released 2.0.4 to fix this
Thank you! Line numbers are reported correctly with 2.0.4.
=== Original file ===
== Example run ==