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

  ID: 20145
  Updated by: alan.campbell@riskpoint.co.uk
  Reported By: alan dot campbell at riskpoint dot co dot uk
  Summary: Custom ruleset does not register PEAR sniffs
  Status: Feedback
  Type: Bug
  Package: PHP_CodeSniffer
  Operating System: OS X (10.9)
  Package Version: 1.5.0
  PHP Version: 5.4.17
  Assigned To: squiz
  Roadmap Versions:
  New Comment:

I have a PEAR directory in the directory where I was running the test.

It seems that phpcs is trying to load the PEAR rules from the PEAR
directory within current working directory and then not finding anyway
as this is not a directory for CodeSniffer rules.

Is this the new expected behaviour? Version 1.4.8 ignored the presence
of my PEAR folder.


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

[2013-12-11 23:05:51] squiz

-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: squiz
This is working fine for me, on OS X (10.9) with the PHP 5.4.17 that
ships with it. I
get:

$ phpcs -v --standard=pear_ruleset.xml phpcs_rules_test.php
Registering sniffs in the MyPEARStandardTest standard... DONE (26 sniffs

registered)
Creating file list... DONE (1 files in queue)
Changing into directory /.../PHP_CodeSniffer
Processing phpcs_rules_test.php [10 tokens in 5 lines]... DONE in < 1
second (2
errors, 0 warnings)

FILE: /.../phpcs_rules_test.php
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 1 LINE(S)
--------------------------------------------------------------------------------
  2 | ERROR | Missing file doc comment
  2 | ERROR | Missing class doc comment
--------------------------------------------------------------------------------

Time: 20 ms, Memory: 2.50Mb

I'm not really sure what to suggest as it looks like we're using the
exact same
environment and sample code.

You could try doing a git clone of the repo and running it directly from
there instead
of via PEAR:

git clone git://github.com/squizlabs/PHP_CodeSniffer.git
cd PHP_CodeSniffer
php scripts/phpcs -v --standard=pear_ruleset.xml phpcs_rules_test.php

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

[2013-12-10 16:40:47] alancampbell

pear_ruleset.xml

<?xml version="1.0"?>
<ruleset name="MyPEARStandardTest">
   <description>Test PEAR coding standard.</description>
   <rule ref="PEAR"/>
</ruleset>

phpcs_rules_test.php

<?php
class PHPCS_Rules_Test
{

}

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

[2013-12-10 16:38:05] alancampbell

-Operating System:
+Operating System: OS X (10.9)


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

[2013-12-10 16:35:33] alancampbell

Description:
------------
Creating a very basic custom rules file loading only PEAR standard does
not register any sniff when run with the following command:

phpcs -v --standard=pear_ruleset.xml phpcs_rules_test.php

Should give the same result as running the following:

phpcs -v --standard=PEAR phpcs_rules_test.php

Repeating the above test, replacing PEAR with all other standards works
as expected and gives the same results.

Expected result:
----------------
Registering sniffs in the PEAR standard... DONE (26 sniffs registered)
Creating file list... DONE (1 files in queue)

Actual result:
--------------
Registering sniffs in the MyPEARStandardTest standard... DONE (0 sniffs
registered)
Creating file list... DONE (1 files in queue)

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

Search Discussions

  • Gsherwood at Dec 12, 2013 at 10:09 pm
    Edit report at https://pear.php.net/bugs/bug.php?id=20145&edit=1

      ID: 20145
      Updated by: gsherwood@squiz.net
      Reported By: alan dot campbell at riskpoint dot co dot uk
      Summary: Custom ruleset does not register PEAR sniffs
      Status: Feedback
      Type: Bug
      Package: PHP_CodeSniffer
      Operating System: OS X (10.9)
      Package Version: 1.5.0
      PHP Version: 5.4.17
      Assigned To: squiz
      Roadmap Versions:
      New Comment:

    Yep, that's the problem. Using -vv:

    Processing ruleset /.../pear_ruleset.xml
      Processing rule "PEAR"
       * rule is referencing a directory of sniffs *
       Adding sniff files from directory

    The ruleset processing code was rewritten from scratch because it didn't
    support
    relative paths and was constantly looking in the wrong places. But now
    it appears
    to be preferencing directories over installed standards, which it
    shouldn't. I'll get
    that fixed up.

    Thanks for getting back to me.


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

    [2013-12-12 17:24:30] alancampbell

    I have a PEAR directory in the directory where I was running the test.

    It seems that phpcs is trying to load the PEAR rules from the PEAR
    directory within current working directory and then not finding anyway
    as this is not a directory for CodeSniffer rules.

    Is this the new expected behaviour? Version 1.4.8 ignored the presence
    of my PEAR folder.

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

    [2013-12-11 23:05:51] squiz

    -Status: Open
    +Status: Feedback
    -Assigned To:
    +Assigned To: squiz
    This is working fine for me, on OS X (10.9) with the PHP 5.4.17 that
    ships with it. I
    get:

    $ phpcs -v --standard=pear_ruleset.xml phpcs_rules_test.php
    Registering sniffs in the MyPEARStandardTest standard... DONE (26 sniffs

    registered)
    Creating file list... DONE (1 files in queue)
    Changing into directory /.../PHP_CodeSniffer
    Processing phpcs_rules_test.php [10 tokens in 5 lines]... DONE in < 1
    second (2
    errors, 0 warnings)

    FILE: /.../phpcs_rules_test.php
    --------------------------------------------------------------------------------
    FOUND 2 ERROR(S) AFFECTING 1 LINE(S)
    --------------------------------------------------------------------------------
      2 | ERROR | Missing file doc comment
      2 | ERROR | Missing class doc comment
    --------------------------------------------------------------------------------

    Time: 20 ms, Memory: 2.50Mb

    I'm not really sure what to suggest as it looks like we're using the
    exact same
    environment and sample code.

    You could try doing a git clone of the repo and running it directly from
    there instead
    of via PEAR:

    git clone git://github.com/squizlabs/PHP_CodeSniffer.git
    cd PHP_CodeSniffer
    php scripts/phpcs -v --standard=pear_ruleset.xml phpcs_rules_test.php

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

    [2013-12-10 16:40:47] alancampbell

    pear_ruleset.xml

    <?xml version="1.0"?>
    <ruleset name="MyPEARStandardTest">
       <description>Test PEAR coding standard.</description>
       <rule ref="PEAR"/>
    </ruleset>

    phpcs_rules_test.php

    <?php
    class PHPCS_Rules_Test
    {

    }

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

    [2013-12-10 16:38:05] alancampbell

    -Operating System:
    +Operating System: OS X (10.9)


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

    [2013-12-10 16:35:33] alancampbell

    Description:
    ------------
    Creating a very basic custom rules file loading only PEAR standard does
    not register any sniff when run with the following command:

    phpcs -v --standard=pear_ruleset.xml phpcs_rules_test.php

    Should give the same result as running the following:

    phpcs -v --standard=PEAR phpcs_rules_test.php

    Repeating the above test, replacing PEAR with all other standards works
    as expected and gives the same results.

    Expected result:
    ----------------
    Registering sniffs in the PEAR standard... DONE (26 sniffs registered)
    Creating file list... DONE (1 files in queue)

    Actual result:
    --------------
    Registering sniffs in the MyPEARStandardTest standard... DONE (0 sniffs
    registered)
    Creating file list... DONE (1 files in queue)

    ------------------------------------------------------------------------
  • Gsherwood at Dec 12, 2013 at 10:24 pm
    Edit report at https://pear.php.net/bugs/bug.php?id=20145&edit=1

      ID: 20145
      Updated by: gsherwood@squiz.net
      Reported By: alan dot campbell at riskpoint dot co dot uk
    -Summary: Custom ruleset does not register PEAR sniffs
    +Summary: Custom ruleset preferences directory over installed
                         standard
      Status: Feedback
      Type: Bug
      Package: PHP_CodeSniffer
      Operating System: OS X (10.9)
      Package Version: 1.5.0
      PHP Version: 5.4.17
      Assigned To: squiz
      Roadmap Versions:
      New Comment:

    -Summary: Custom ruleset does not register PEAR sniffs
    +Summary: Custom ruleset preferences directory over installed
               standard



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

    [2013-12-12 23:18:44] squiz

    Yep, that's the problem. Using -vv:

    Processing ruleset /.../pear_ruleset.xml
      Processing rule "PEAR"
       * rule is referencing a directory of sniffs *
       Adding sniff files from directory

    The ruleset processing code was rewritten from scratch because it didn't
    support
    relative paths and was constantly looking in the wrong places. But now
    it appears
    to be preferencing directories over installed standards, which it
    shouldn't. I'll get
    that fixed up.

    Thanks for getting back to me.

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

    [2013-12-12 17:24:30] alancampbell

    I have a PEAR directory in the directory where I was running the test.

    It seems that phpcs is trying to load the PEAR rules from the PEAR
    directory within current working directory and then not finding anyway
    as this is not a directory for CodeSniffer rules.

    Is this the new expected behaviour? Version 1.4.8 ignored the presence
    of my PEAR folder.

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

    [2013-12-11 23:05:51] squiz

    -Status: Open
    +Status: Feedback
    -Assigned To:
    +Assigned To: squiz
    This is working fine for me, on OS X (10.9) with the PHP 5.4.17 that
    ships with it. I
    get:

    $ phpcs -v --standard=pear_ruleset.xml phpcs_rules_test.php
    Registering sniffs in the MyPEARStandardTest standard... DONE (26 sniffs

    registered)
    Creating file list... DONE (1 files in queue)
    Changing into directory /.../PHP_CodeSniffer
    Processing phpcs_rules_test.php [10 tokens in 5 lines]... DONE in < 1
    second (2
    errors, 0 warnings)

    FILE: /.../phpcs_rules_test.php
    --------------------------------------------------------------------------------
    FOUND 2 ERROR(S) AFFECTING 1 LINE(S)
    --------------------------------------------------------------------------------
      2 | ERROR | Missing file doc comment
      2 | ERROR | Missing class doc comment
    --------------------------------------------------------------------------------

    Time: 20 ms, Memory: 2.50Mb

    I'm not really sure what to suggest as it looks like we're using the
    exact same
    environment and sample code.

    You could try doing a git clone of the repo and running it directly from
    there instead
    of via PEAR:

    git clone git://github.com/squizlabs/PHP_CodeSniffer.git
    cd PHP_CodeSniffer
    php scripts/phpcs -v --standard=pear_ruleset.xml phpcs_rules_test.php

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

    [2013-12-10 16:40:47] alancampbell

    pear_ruleset.xml

    <?xml version="1.0"?>
    <ruleset name="MyPEARStandardTest">
       <description>Test PEAR coding standard.</description>
       <rule ref="PEAR"/>
    </ruleset>

    phpcs_rules_test.php

    <?php
    class PHPCS_Rules_Test
    {

    }

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

    [2013-12-10 16:38:05] alancampbell

    -Operating System:
    +Operating System: OS X (10.9)


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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
         http://pear.php.net/bugs/bug.php?id=20145
  • Gsherwood at Dec 12, 2013 at 10:26 pm
    Edit report at https://pear.php.net/bugs/bug.php?id=20145&edit=1

      ID: 20145
      Updated by: gsherwood@squiz.net
      Reported By: alan dot campbell at riskpoint dot co dot uk
      Summary: Custom ruleset preferences directory over installed
                         standard
    -Status: Feedback
    +Status: Closed
      Type: Bug
      Package: PHP_CodeSniffer
      Operating System: OS X (10.9)
      Package Version: 1.5.0
      PHP Version: 5.4.17
      Assigned To: squiz
      Roadmap Versions:
      New Comment:

    -Status: Feedback
    +Status: Closed
    Fix committed to github repo:
    https://github.com/squizlabs/PHP_CodeSniffer/commit/227bc6e6f8c1c210fa36a5de4e
    352bb3f5688265


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

    [2013-12-12 23:33:24] squiz

    -Summary: Custom ruleset does not register PEAR sniffs
    +Summary: Custom ruleset preferences directory over installed
               standard


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

    [2013-12-12 23:18:44] squiz

    Yep, that's the problem. Using -vv:

    Processing ruleset /.../pear_ruleset.xml
      Processing rule "PEAR"
       * rule is referencing a directory of sniffs *
       Adding sniff files from directory

    The ruleset processing code was rewritten from scratch because it didn't
    support
    relative paths and was constantly looking in the wrong places. But now
    it appears
    to be preferencing directories over installed standards, which it
    shouldn't. I'll get
    that fixed up.

    Thanks for getting back to me.

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

    [2013-12-12 17:24:30] alancampbell

    I have a PEAR directory in the directory where I was running the test.

    It seems that phpcs is trying to load the PEAR rules from the PEAR
    directory within current working directory and then not finding anyway
    as this is not a directory for CodeSniffer rules.

    Is this the new expected behaviour? Version 1.4.8 ignored the presence
    of my PEAR folder.

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

    [2013-12-11 23:05:51] squiz

    -Status: Open
    +Status: Feedback
    -Assigned To:
    +Assigned To: squiz
    This is working fine for me, on OS X (10.9) with the PHP 5.4.17 that
    ships with it. I
    get:

    $ phpcs -v --standard=pear_ruleset.xml phpcs_rules_test.php
    Registering sniffs in the MyPEARStandardTest standard... DONE (26 sniffs

    registered)
    Creating file list... DONE (1 files in queue)
    Changing into directory /.../PHP_CodeSniffer
    Processing phpcs_rules_test.php [10 tokens in 5 lines]... DONE in < 1
    second (2
    errors, 0 warnings)

    FILE: /.../phpcs_rules_test.php
    --------------------------------------------------------------------------------
    FOUND 2 ERROR(S) AFFECTING 1 LINE(S)
    --------------------------------------------------------------------------------
      2 | ERROR | Missing file doc comment
      2 | ERROR | Missing class doc comment
    --------------------------------------------------------------------------------

    Time: 20 ms, Memory: 2.50Mb

    I'm not really sure what to suggest as it looks like we're using the
    exact same
    environment and sample code.

    You could try doing a git clone of the repo and running it directly from
    there instead
    of via PEAR:

    git clone git://github.com/squizlabs/PHP_CodeSniffer.git
    cd PHP_CodeSniffer
    php scripts/phpcs -v --standard=pear_ruleset.xml phpcs_rules_test.php

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

    [2013-12-10 16:40:47] alancampbell

    pear_ruleset.xml

    <?xml version="1.0"?>
    <ruleset name="MyPEARStandardTest">
       <description>Test PEAR coding standard.</description>
       <rule ref="PEAR"/>
    </ruleset>

    phpcs_rules_test.php

    <?php
    class PHPCS_Rules_Test
    {

    }

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
         http://pear.php.net/bugs/bug.php?id=20145

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedDec 12, '13 at 4:15p
activeDec 12, '13 at 10:26p
posts4
users2
websitepear.php.net

2 users in discussion

Gsherwood: 3 posts Alan Campbell: 1 post

People

Translate

site design / logo © 2022 Grokbase