Edit report at https://pear.php.net/bugs/bug.php?id=20373&edit=1
ID: 20373
Updated by: [email protected]
Reported By: aik dot bold at gmail dot com
Summary: Inline comment sniff tab handling way
-Status: Open
+Status: Closed
Type: Bug
Package: PHP_CodeSniffer
Operating System: Linux
Package Version: 1.5.4
PHP Version: 5.4.20
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:
-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.
Previous Comments:
------------------------------------------------------------------------
[2014-08-22 19:52:36] aik099
With spaces used as indentation ltrim doesn't change the output, but
with tabs it's different.
------------------------------------------------------------------------
[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
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.