| 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:
With spaces used as indentation ltrim doesn't change the output, but
with tabs it's different.
Previous Comments:
------------------------------------------------------------------------
[2014-08-22 19:50:43] aik099
There also should be "ltrim" on
https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Squiz/Sniffs/Commenting/InlineCommentSniff.php#L176
line.
------------------------------------------------------------------------
[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