Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.7.1

Bug #18628 Generic.Files.LineLength gives incorrect results with Windows line-endings.
Submitted: 2011-06-24 20:42 UTC
From: happydog Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.3.0)
PHP Version: 5.2.8 OS: Ubuntu
Roadmaps: (Not assigned)    

 [2011-06-24 20:42 UTC] happydog (Mark Clements)
Description: ------------ The built-in rule, Generic.Files.LineLength, doesn't handle files with Windows line-endings (\r\n) correctly. It treats the \r character (carriage-return) as part of the line, and therefore miscounts the length of each line as one greater than it should be. If you are in a build environment where all files are in Windows-format, then there is a workaround (to set the maximum line length as one greater than your actual limit) but this is not intuitive, nor documented. It also does not work in environments where the line-endings may vary between files (e.g. where there is third-party code). I am aware that the code was built based on PEAR standards, but there is a separate rule to check appropriate line-ending characters are in place, but this is a separate rule which should be eol-style agnostic.


 [2011-07-13 09:29 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Verified -Assigned To: +Assigned To: squiz
 [2011-07-13 09:37 UTC] squiz (Greg Sherwood)
-Status: Verified +Status: Closed
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.