[PEAR-BUG] Bug #20373 [Com]: Inline comment sniff tab handling way

[email protected] ("[email protected]")
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at https://pear.php.net/bugs/bug.php?id=20373&edit=1

 ID:               20373
 Comment by:       [email protected]
 Reported By:      aik dot bold at gmail dot com
 Summary:          Inline comment sniff tab handling way
 Status:           Open
 Type:             Bug
 Package:          PHP_CodeSniffer
 Operating System: Linux
 Package Version:  1.5.4
 PHP Version:      5.4.20
 Roadmap Versions: 
 New Comment:

There also should be "ltrim" on
https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Squiz/Sniffs/Commenting/InlineCommentSniff.php#L176
line.


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

[2014-08-22 19:44:54] aik099

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.

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


-- 
Edit this bug report at https://pear.php.net/bugs/bug.php?id=20373&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.