Skip to content
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

Reporting incorrect line number #5

Closed
relud opened this issue Jun 28, 2016 · 12 comments
Closed

Reporting incorrect line number #5

relud opened this issue Jun 28, 2016 · 12 comments

Comments

@relud
Copy link
Contributor

relud commented Jun 28, 2016

=== Original file ===

# doc
class agent(
$group = '',
){
}

== Example run ==

$ puppet-lint init.pp
./manifests/init.pp - WARNING: indent should be 2 chars and is 0 on line 2
@relud
Copy link
Contributor Author

relud commented Jul 5, 2016

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

@relud relud closed this as completed Jul 5, 2016
@wybczu
Copy link

wybczu commented Aug 22, 2016

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.

@wybczu
Copy link

wybczu commented Aug 22, 2016

From what I can see in the code, using token.next_token in notify for line number and column should fix the issue.

@relud
Copy link
Contributor Author

relud commented Aug 22, 2016

line 3 is $group = '',, which is the one that's incorrectly indented

@wybczu
Copy link

wybczu commented Aug 22, 2016

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,
                  ^

@relud relud reopened this Aug 22, 2016
@relud
Copy link
Contributor Author

relud commented Aug 22, 2016

could you give me your include puppet-lint version and ruby version for testing

@wybczu
Copy link

wybczu commented Aug 24, 2016

$ 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)

@wybczu
Copy link

wybczu commented Aug 24, 2016

Tested also on

ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux-gnu]

@jijojv
Copy link

jijojv commented Aug 26, 2016

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)

@relud
Copy link
Contributor Author

relud commented Aug 26, 2016

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.

@relud relud closed this as completed in 0ca04e7 Aug 26, 2016
@relud
Copy link
Contributor Author

relud commented Aug 26, 2016

released 2.0.4 to fix this

@wybczu
Copy link

wybczu commented Aug 27, 2016

Thank you! Line numbers are reported correctly with 2.0.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants