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

Bug #20373 Inline comment sniff tab handling way
Submitted: 2014-08-22 23:44 UTC
From: aik099 Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.5.4)
PHP Version: 5.4.20 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2014-08-22 23:44 UTC] aik099 (Alexander Obuhovich)
Description: ------------ Consider following code: http://screencast.com/t/wgfDpfkyyCTu (image given so you can see where there are tabs and where spaces): ----- class SomeClass { function someMethod() { // This is comment indented with spaces. $a = 5; // This is comment indented with tabs. $a = 5; } } ----- When determening how much spaces there are between // and actual text in https://github.com/squizlabs/PHP_CodeSniffer/blob/master/Code Sniffer/Standards/Squiz/Sniffs/Commenting/InlineCommentSniff. php#L166 code only spaces are considered. This way for code above I'm getting error message like this: No space before comment text; expected "// This is comment indented with tabs." but found "// This is In fact there are 2 tabs which is equivalent of 8 spaces. I recommend checking also for \t when counting spaces.

Comments

 [2014-08-22 23:52 UTC] aik099 (Alexander Obuhovich)
With spaces used as indentation ltrim doesn't change the output, but with tabs it's different.
 [2014-08-26 07:18 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
Fix committed to Github repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/a6ed904a1ab4bd6d551666593 8b21839e9cbe75f Now throws a very specific error if tabs are used to indent the comment.