Menu

#26 Empty lines in comments will corrupt line numbering

Fixed
nobody
None
Medium
Defect
2012-02-09
2012-02-09
Anonymous
No

Originally created by: Daniel...@gmail.com

Example code:
<?php
/*

*/
$a = 1; // this is line 5, but the warning is for line 4
?>

Actual output is:
dani@dani-P55-UD3L:~/php/PHPCheckstyle/PhpCheckstyle$ php run.php --src test.php --format console
test.php WARNING Line:4 - Undeclared or unused variable : '$a'.

Expected output:
test.php WARNING Line:5 - Undeclared or unused variable : '$a'.

I use geany. If I set line endings to CR/LF(Windows), than I get correct output "Line:5". If I set line endings to LF(Unix), I get wrong "Line:4"

Version info:
dani@dani-P55-UD3L:~/php/PHPCheckstyle/PhpCheckstyle$ svn info | grep Revision
Revision: 96

Related

Wiki: History

Discussion

  • Anonymous

    Anonymous - 2012-02-09

    Originally posted by: tch...@hotmail.com

    (No comment was entered for this change.)

    Status: Accepted

     
  • Anonymous

    Anonymous - 2012-02-09

    Originally posted by: tch...@hotmail.com

    Thanks for your report.

    In the case of a new line inside a commetn I was relying on the PHP_EOL constant. I didn't though of the case of a PHP file with line endings different that the default value for the current system.

    I have commited a patch on the trunk, can you have a look and tell me if it works for you ?

    Thanks a lot.

    Status: Fixed

     
  • Anonymous

    Anonymous - 2012-02-09

    Originally posted by: Daniel...@gmail.com

    Yes fixed, line numbers are now correct in my multi-thousand line files, thanks.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.