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

Bug #19699 Generic.Files.LineLength giving false positives when tab-width is used
Submitted: 2012-11-11 04:55 UTC
From: happydog Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.4.2)
PHP Version: Irrelevant OS: All
Roadmaps: (Not assigned)    
Subscription  


 [2012-11-11 04:55 UTC] happydog (Mark Clements)
Description: ------------ I'm running the Generic.Files.LineLength Sniff on my files and am getting a lot of false positives. I will attach a test case which demonstrates the issue.

Comments

 [2012-11-11 05:01 UTC] happydog (Mark Clements)
OK - well, it looks like the crappy bug-tracker won't accept anything except text files, and even when I rename them "Example.txt" before uploading it borks and refuses the upload, as it has detected them as PHP files. I can't paste them here as white-space will be mangled, which I'm sure is the cause of the problem, so can someone either fix the bug-tracker or give me an e-mail address to send the test-cases to.
 [2012-11-11 07:40 UTC] squiz (Greg Sherwood)
-Assigned To: +Assigned To: squiz
Hi Mark, Please send me the test case: gsherwood at squiz dot net
 [2012-11-11 22:51 UTC] happydog (Mark Clements)
Sent.
 [2012-11-12 03:15 UTC] squiz (Greg Sherwood)
-Summary: Generic.Files.LineLength giving false positives. +Summary: Generic.Files.LineLength giving false positives when tab-width is used
 [2012-11-12 03:17 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
Thanks for the detailed test case and output. It made testing very easy. The problem was with PHP_CodeSniffer's conversion of tabs to spaces for calculating column numbers. I've committed a fix to the github repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/dcf61b5f3feb677f190f5b0bbea c246533045c3b
 [2012-11-12 04:08 UTC] happydog (Mark Clements)
Fantastic - once again impressed by the speed of resolution! Plus - it's always good to see a bugfix that involves code being removed, rather than added. :-)
 [2012-11-12 04:11 UTC] happydog (Mark Clements)
PS - Might it be worth adding my test case to your unit tests?
 [2012-11-12 04:59 UTC] squiz (Greg Sherwood)
I dont have the ability to test things that vary the command line settings yet. It is a limitation in my testing system.
 [2012-11-12 16:31 UTC] happydog (Mark Clements)
Oh well - fair enough. Thanks for the fix.