jenkins-bot has submitted this change and it was merged.

Change subject: Remove dead code from SpaceBeforeSingleLineCommentSniff
......................................................................


Remove dead code from SpaceBeforeSingleLineCommentSniff

This is dead code that does nothing. Here is why: The regular expression
matches any sequence of hash characters, even an empty sequence. But the
regex is not bound. It matches this anywhere inside the given string.
It searches for a pattern that can be empty. But every string contains an
empty pattern, no matter what the string actually contains. This means this
regex always succeeds and is never false.

I'm aware that this code had a purpose and was introduced in
https://gerrit.wikimedia.org/r/243619 for a reason. However, there was never
a test for this and I'm currently not aware of anybody complaining that this
particular feature was broken. So instead of fixing it I suggest to remove
it for now and re-add it later when somebody really asks for it.

Change-Id: I489874c67e404757f323e66c49f720e8a2d705ee
---
M MediaWiki/Sniffs/WhiteSpace/SpaceBeforeSingleLineCommentSniff.php
1 file changed, 0 insertions(+), 3 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/MediaWiki/Sniffs/WhiteSpace/SpaceBeforeSingleLineCommentSniff.php 
b/MediaWiki/Sniffs/WhiteSpace/SpaceBeforeSingleLineCommentSniff.php
index a1bea4a..1d3d851 100644
--- a/MediaWiki/Sniffs/WhiteSpace/SpaceBeforeSingleLineCommentSniff.php
+++ b/MediaWiki/Sniffs/WhiteSpace/SpaceBeforeSingleLineCommentSniff.php
@@ -24,9 +24,6 @@
                                || substr( $currToken['content'], 0, 3 ) === 
'///'
                        ) {
                                return;
-                       // Checking if it's a comment separator
-                       } elseif ( preg_match( '/#*/', $currToken['content'] ) 
=== false ) {
-                               return;
                        }
 
                        // Checking whether the comment is an empty one

-- 
To view, visit https://gerrit.wikimedia.org/r/250996
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I489874c67e404757f323e66c49f720e8a2d705ee
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/tools/codesniffer
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Polybuildr <[email protected]>
Gerrit-Reviewer: TasneemLo <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to