[PEAR-BUG] Bug #18628 [Opn->Ver]: Generic.Files.LineLength gives incorrect results with Windows line-endings.

[email protected]
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at http://pear.php.net/bugs/bug.php?id=18628&edit=1

 ID:               18628
 Updated by:       [email protected]
 Reported By:      pear at kennel17 dot co dot uk
 Summary:          Generic.Files.LineLength gives incorrect results with
                    Windows line-endings.
-Status:           Open
+Status:           Verified
 Type:             Bug
 Package:          PHP_CodeSniffer
 Operating System: Ubuntu
 Package Version:  1.3.0
 PHP Version:      5.2.8
-Assigned To:      
+Assigned To:      squiz
 Roadmap Versions: 
 New Comment:

-Status:      Open
+Status:      Verified
-Assigned To:
+Assigned To: squiz



Previous Comments:
------------------------------------------------------------------------

[2011-06-24 16:42:12] happydog

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.

------------------------------------------------------------------------


-- 
Edit this bug report at http://pear.php.net/bugs/bug.php?id=18628&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.