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

Bug #19502 Generic.Files.LineEndingsSniff fails if no new-lines in file.
Submitted: 2012-07-11 15:35 UTC
From: happydog Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.3.4)
PHP Version: Irrelevant OS: All
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 25 - 12 = ?

 
 [2012-07-11 15:35 UTC] happydog (Mark Clements)
Description: ------------ Running the Generic.Files.LineEndingsSniff on a file without any new-lines results in the Sniff reporting that the file has the wrong line-endings. Expected result: ---------------- That a file with no line-endings is treated as having the correct line-endings. Actual result: -------------- That a file with no line-endings is reported as having the INCORRECT line-endings.

Comments

 [2012-07-23 10:20 UTC] squiz (Greg Sherwood)
-Assigned To: +Assigned To: squiz
PHP_CodeSniffer has specific code in the EOL detection method that checks if there is no EOL char on the first line (a one-line file) and sets the EOL char to \n in this case. Your standard must be enforcing the use of an EOL char that is not \n, which is where the error comes from. I need to change the sniff so it knows that this is a special case.
 [2012-07-23 11:20 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
Fixed in github repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/0640e1f35538506a2e87995ea 3697b6674ccde8e But many other sniffs also use the EOL char, so you may come up against other errors in custom standards.
 [2012-08-03 16:07 UTC] happydog (Mark Clements)
Thanks. So far I have not come across any other sniffs that cause issues with Windows line-endings, but if I do I will log bugs for them.