Edit report at https://pear.php.net/bugs/bug.php?id=19437&edit=1

ID: 19437
Updated by: gsherwood@squiz.net
Reported By: jakub dot boucek@socialbakers.com
Summary: Ingoring Sniffs with dots on Windows
-Status: Feedback
+Status: Duplicate
Type: Bug
Package: PHP_CodeSniffer
Operating System: Windows 7, 64-bit
Package Version: 1.3.4
PHP Version: 5.3.13
Assigned To: squiz
Roadmap Versions:
New Comment:

-Status: Feedback
+Status: Duplicate
If this turns out to be a different issue, please reopen.

Previous Comments:

[2012-06-19 01:16:26] squiz

-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: squiz
I think this is the same as bug #19471, which I committed a fix for. Can
you please
try the latest git version of PHPCS to see if this resolves the issue.

Instructions for running from a git clone are here:


[2012-06-05 02:33:04] juanmf

$sniffPos = strrpos($file,
false === $sniffPos && $sniffPos = strrpos($file,

added the 2nd line. at line 660. made it work.


[2012-05-24 17:12:01] jakubboucek

If i use some rules with dots in name like a
<rule ref="Generic.Files.LineLength">
then will be library path defined as

See the shlashes - some is right-shlash, other is backshlash.

While running test, this rule is ignored.

Why? Function setTokenListeners() tests, if the sniff's path is in the
right conventions and check it with DIRECTORY_SEPARATOR. Specifically
check if the string contains '\Sniffs\'. As I said, this part of string
is directly defined with / (right-slash). Test fails and Sniff
definition is ignored.

The simpliest fix is appending the line above path checking:
//File: <pear_root>\PHP\CodeSniffer.php:656
//Notmalize path
$file = realpath($file);

Test script:

<?xml version="1.0"?>
<ruleset name="Bug check">
<rule ref="Generic.Commenting.Todo" />

Expected result:
Registering sniffs in Bug check standard... DONE (1 sniffs registered)

Actual result:
Registering sniffs in Bug check standard... DONE (0 sniffs registered)


Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
postedJul 10, '12 at 12:23a
activeJul 10, '12 at 12:23a

1 user in discussion

Gsherwood: 1 post



site design / logo © 2022 Grokbase