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

ID: 19246
Comment by: das_peter
Reported By: info at das-peter dot ch
Summary: In Eclipse CodeSniffer drops the extensions paramater
Status: Feedback
Type: Bug
Package: PHP_CodeSniffer
Operating System: Mac
Package Version: 1.3.2
PHP Version: 5.3.1
Assigned To: squiz
New Comment:

I've just posted a pull request which should fix the issue:
https://github.com/pear/PHP_CodeSniffer/pull/3

The problem isn't that you can't pass extensions but according to the
advanced usage documentation
(http://pear.php.net/manual/en/package.php.php-codesniffer.advanced-usage.php)
extensions are ignored if a file is explicitly passed.
That's not the case atm. we should decide whether to change the code (my
favourite) or the documentation.


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

[2012-01-29 22:52:33] squiz

<div id="changeset">
<span class="removed">-Status: Open</span>
<span class="added">+Status: Feedback</span>
<span class="removed">-Assigned To:</span>
<span class="added">+Assigned To: squiz</span>
</div>You may want to try running phpcs on the command line to make sure
it is working. I
have tried it and it works correctly for me when I specify an extensions
command
line argument such as:
phpcs --extensions=php,module ...

I didn't write the eclipse plugin and have never used it, but if the
command line
works fine for you, then it is the eclipse plugin that is broken and not

PHP_CodeSniffer. I don't see any --extensions argument in the debug
output you
provided, so maybe it hasn't been added correctly to the plugin.

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

[2012-01-24 12:27:55] barnettech

Description:
------------
I successfully installed code sniffer in Eclipse, but it only works
on .php files. I right clicked on preferences->php tools ->php
CodeSniffer and I set file extensions to be
php,module,inc,install,test,profile,theme and still the code sniffer
only flags files with the php extension.

In the console I see the extensions parameter did not get set,
here is what I see:

/usr/bin/php -c
/var/folders/q6/44cl7bwn1blfrxchzns459rh0000gp/T/zend_debu
g/session3952346344543095394.tmp -d asp_tags=off
/Applications/eclipse/plugins/org.phpsrc.eclipse.pti.tools.codesni
ffer_1.3.0.R20111119000000/php/tools/phpcs.php --report=xml
--
standard=/Users/barnettech/drush/drupalcs/DrupalCodingStand
ard
/Users/barnettech/Sites/belldev/git/dev/babsoncomm/docroot/si
tes/all/modules/custom/folder_timerelease/folder_timerelease.
module
<?xml version="1.0" encoding="UTF-8"?>
<phpcs version="1.3.2">
</phpcs>


So I did some digging. If I insert these lines on lines 424 and
425 of
/Users/barnettech/pear/share/pear/PHP/CodeSniffer/CLI.php

$the_extensions = 'php,module';
$values['extensions'] = explode(',', $the_extensions);
Then it will start examining files with both php and module as an
extension.

I just confirmed that the only thing in variable $arg when public
function processLongArgument($arg, $pos, $values) gets called
is:
"standard=/Users/barnettech/drush/drupalcs/DrupalCodingStan
dard" (that function is in the CLI.php file mentioned above). So
the extensions parameter is never getting set.

This bug was discussed in drupal forum:
http://drupal.org/node/1414902

Expected result:
----------------
I would have expected to be able to run CodeSniffer on any file
extension that I specify

Actual result:
--------------
The actual result is even if you specify valid extensions it only
works with files with extension php.

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


--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=19246&edit=1

Search Discussions

  • Gsherwood at Feb 7, 2012 at 11:14 pm
    Edit report at https://pear.php.net/bugs/bug.php?id=19246&edit=1

    ID: 19246
    Updated by: gsherwood@squiz.net
    Reported By: barnettech at gmail dot com
    Summary: In Eclipse CodeSniffer drops the extensions paramater
    Status: Feedback
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Mac
    Package Version: 1.3.2
    PHP Version: 5.3.1
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    Try the current git version of PHP_CodeSniffer. I believe this has
    already been fixed
    and have confirmed I can NOT call phpcs on a temp.module file with
    latest stable but
    I can with the latest dev code.

    To grab the latest dev:
    pear uninstall php_codesniffer
    git clone git://github.com/squizlabs/PHP_CodeSniffer.git
    cd PHP_CodeSniffer
    pear install package.xml

    You might need to use sudo on those pear commands.

    Also, please submit pull requests to squizlabs/PHP_CodeSniffer in the
    future because
    I don't maintain that PEAR fork. I know it is confusing and I have no
    idea why
    someone decided to make it that way.


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

    [2012-02-03 18:16:57] das_peter

    I've just posted a pull request which should fix the issue:
    https://github.com/pear/PHP_CodeSniffer/pull/3

    The problem isn't that you can't pass extensions but according to the
    advanced usage documentation
    (http://pear.php.net/manual/en/package.php.php-codesniffer.advanced-usage.php)
    extensions are ignored if a file is explicitly passed.
    That's not the case atm. we should decide whether to change the code (my
    favourite) or the documentation.

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

    [2012-01-29 22:52:33] squiz

    -Status: Open
    +Status: Feedback
    -Assigned To:
    +Assigned To: squiz
    You may want to try running phpcs on the command line to make sure it is
    working. I
    have tried it and it works correctly for me when I specify an extensions
    command
    line argument such as:
    phpcs --extensions=php,module ...

    I didn't write the eclipse plugin and have never used it, but if the
    command line
    works fine for you, then it is the eclipse plugin that is broken and not

    PHP_CodeSniffer. I don't see any --extensions argument in the debug
    output you
    provided, so maybe it hasn't been added correctly to the plugin.

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

    [2012-01-24 12:27:55] barnettech

    Description:
    ------------
    I successfully installed code sniffer in Eclipse, but it only works
    on .php files. I right clicked on preferences->php tools ->php
    CodeSniffer and I set file extensions to be
    php,module,inc,install,test,profile,theme and still the code sniffer
    only flags files with the php extension.

    In the console I see the extensions parameter did not get set,
    here is what I see:

    /usr/bin/php -c
    /var/folders/q6/44cl7bwn1blfrxchzns459rh0000gp/T/zend_debu
    g/session3952346344543095394.tmp -d asp_tags=off
    /Applications/eclipse/plugins/org.phpsrc.eclipse.pti.tools.codesni
    ffer_1.3.0.R20111119000000/php/tools/phpcs.php --report=xml
    --
    standard=/Users/barnettech/drush/drupalcs/DrupalCodingStand
    ard
    /Users/barnettech/Sites/belldev/git/dev/babsoncomm/docroot/si
    tes/all/modules/custom/folder_timerelease/folder_timerelease.
    module
    <?xml version="1.0" encoding="UTF-8"?>
    <phpcs version="1.3.2">
    </phpcs>


    So I did some digging. If I insert these lines on lines 424 and
    425 of
    /Users/barnettech/pear/share/pear/PHP/CodeSniffer/CLI.php

    $the_extensions = 'php,module';
    $values['extensions'] = explode(',', $the_extensions);
    Then it will start examining files with both php and module as an
    extension.

    I just confirmed that the only thing in variable $arg when public
    function processLongArgument($arg, $pos, $values) gets called
    is:
    "standard=/Users/barnettech/drush/drupalcs/DrupalCodingStan
    dard" (that function is in the CLI.php file mentioned above). So
    the extensions parameter is never getting set.

    This bug was discussed in drupal forum:
    http://drupal.org/node/1414902

    Expected result:
    ----------------
    I would have expected to be able to run CodeSniffer on any file
    extension that I specify

    Actual result:
    --------------
    The actual result is even if you specify valid extensions it only
    works with files with extension php.

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


    --
    Edit this bug report at https://pear.php.net/bugs/bug.php?id=19246&edit=1
  • Info at Feb 10, 2012 at 3:13 pm
    Edit report at https://pear.php.net/bugs/bug.php?id=19246&edit=1

    ID: 19246
    Comment by: info@das-peter.ch
    Reported By: barnettech at gmail dot com
    Summary: In Eclipse CodeSniffer drops the extensions paramater
    Status: Feedback
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Mac
    Package Version: 1.3.2
    PHP Version: 5.3.1
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    Confirmed, latest dev works as expected.
    Thanks :)


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

    [2012-02-08 00:16:04] squiz

    Try the current git version of PHP_CodeSniffer. I believe this has
    already been fixed
    and have confirmed I can NOT call phpcs on a temp.module file with
    latest stable but
    I can with the latest dev code.

    To grab the latest dev:
    pear uninstall php_codesniffer
    git clone git://github.com/squizlabs/PHP_CodeSniffer.git
    cd PHP_CodeSniffer
    pear install package.xml

    You might need to use sudo on those pear commands.

    Also, please submit pull requests to squizlabs/PHP_CodeSniffer in the
    future because
    I don't maintain that PEAR fork. I know it is confusing and I have no
    idea why
    someone decided to make it that way.

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

    [2012-02-03 18:16:57] das_peter

    I've just posted a pull request which should fix the issue:
    https://github.com/pear/PHP_CodeSniffer/pull/3

    The problem isn't that you can't pass extensions but according to the
    advanced usage documentation
    (http://pear.php.net/manual/en/package.php.php-codesniffer.advanced-usage.php)
    extensions are ignored if a file is explicitly passed.
    That's not the case atm. we should decide whether to change the code (my
    favourite) or the documentation.

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

    [2012-01-29 22:52:33] squiz

    -Status: Open
    +Status: Feedback
    -Assigned To:
    +Assigned To: squiz
    You may want to try running phpcs on the command line to make sure it is
    working. I
    have tried it and it works correctly for me when I specify an extensions
    command
    line argument such as:
    phpcs --extensions=php,module ...

    I didn't write the eclipse plugin and have never used it, but if the
    command line
    works fine for you, then it is the eclipse plugin that is broken and not

    PHP_CodeSniffer. I don't see any --extensions argument in the debug
    output you
    provided, so maybe it hasn't been added correctly to the plugin.

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

    [2012-01-24 12:27:55] barnettech

    Description:
    ------------
    I successfully installed code sniffer in Eclipse, but it only works
    on .php files. I right clicked on preferences->php tools ->php
    CodeSniffer and I set file extensions to be
    php,module,inc,install,test,profile,theme and still the code sniffer
    only flags files with the php extension.

    In the console I see the extensions parameter did not get set,
    here is what I see:

    /usr/bin/php -c
    /var/folders/q6/44cl7bwn1blfrxchzns459rh0000gp/T/zend_debu
    g/session3952346344543095394.tmp -d asp_tags=off
    /Applications/eclipse/plugins/org.phpsrc.eclipse.pti.tools.codesni
    ffer_1.3.0.R20111119000000/php/tools/phpcs.php --report=xml
    --
    standard=/Users/barnettech/drush/drupalcs/DrupalCodingStand
    ard
    /Users/barnettech/Sites/belldev/git/dev/babsoncomm/docroot/si
    tes/all/modules/custom/folder_timerelease/folder_timerelease.
    module
    <?xml version="1.0" encoding="UTF-8"?>
    <phpcs version="1.3.2">
    </phpcs>


    So I did some digging. If I insert these lines on lines 424 and
    425 of
    /Users/barnettech/pear/share/pear/PHP/CodeSniffer/CLI.php

    $the_extensions = 'php,module';
    $values['extensions'] = explode(',', $the_extensions);
    Then it will start examining files with both php and module as an
    extension.

    I just confirmed that the only thing in variable $arg when public
    function processLongArgument($arg, $pos, $values) gets called
    is:
    "standard=/Users/barnettech/drush/drupalcs/DrupalCodingStan
    dard" (that function is in the CLI.php file mentioned above). So
    the extensions parameter is never getting set.

    This bug was discussed in drupal forum:
    http://drupal.org/node/1414902

    Expected result:
    ----------------
    I would have expected to be able to run CodeSniffer on any file
    extension that I specify

    Actual result:
    --------------
    The actual result is even if you specify valid extensions it only
    works with files with extension php.

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


    --
    Edit this bug report at https://pear.php.net/bugs/bug.php?id=19246&edit=1
  • Gsherwood at Feb 10, 2012 at 9:35 pm
    Edit report at https://pear.php.net/bugs/bug.php?id=19246&edit=1

    ID: 19246
    Updated by: gsherwood@squiz.net
    Reported By: barnettech at gmail dot com
    Summary: In Eclipse CodeSniffer drops the extensions paramater
    -Status: Feedback
    +Status: Closed
    Type: Bug
    Package: PHP_CodeSniffer
    Operating System: Mac
    Package Version: 1.3.2
    PHP Version: 5.3.1
    Assigned To: squiz
    Roadmap Versions:
    New Comment:

    -Status: Feedback
    +Status: Closed
    Good news. Thanks a lot for getting back to me.


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

    [2012-02-10 16:15:14] das_peter

    Confirmed, latest dev works as expected.
    Thanks :)

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

    [2012-02-08 00:16:04] squiz

    Try the current git version of PHP_CodeSniffer. I believe this has
    already been fixed
    and have confirmed I can NOT call phpcs on a temp.module file with
    latest stable but
    I can with the latest dev code.

    To grab the latest dev:
    pear uninstall php_codesniffer
    git clone git://github.com/squizlabs/PHP_CodeSniffer.git
    cd PHP_CodeSniffer
    pear install package.xml

    You might need to use sudo on those pear commands.

    Also, please submit pull requests to squizlabs/PHP_CodeSniffer in the
    future because
    I don't maintain that PEAR fork. I know it is confusing and I have no
    idea why
    someone decided to make it that way.

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

    [2012-02-03 18:16:57] das_peter

    I've just posted a pull request which should fix the issue:
    https://github.com/pear/PHP_CodeSniffer/pull/3

    The problem isn't that you can't pass extensions but according to the
    advanced usage documentation
    (http://pear.php.net/manual/en/package.php.php-codesniffer.advanced-usage.php)
    extensions are ignored if a file is explicitly passed.
    That's not the case atm. we should decide whether to change the code (my
    favourite) or the documentation.

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

    [2012-01-29 22:52:33] squiz

    -Status: Open
    +Status: Feedback
    -Assigned To:
    +Assigned To: squiz
    You may want to try running phpcs on the command line to make sure it is
    working. I
    have tried it and it works correctly for me when I specify an extensions
    command
    line argument such as:
    phpcs --extensions=php,module ...

    I didn't write the eclipse plugin and have never used it, but if the
    command line
    works fine for you, then it is the eclipse plugin that is broken and not

    PHP_CodeSniffer. I don't see any --extensions argument in the debug
    output you
    provided, so maybe it hasn't been added correctly to the plugin.

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

    [2012-01-24 12:27:55] barnettech

    Description:
    ------------
    I successfully installed code sniffer in Eclipse, but it only works
    on .php files. I right clicked on preferences->php tools ->php
    CodeSniffer and I set file extensions to be
    php,module,inc,install,test,profile,theme and still the code sniffer
    only flags files with the php extension.

    In the console I see the extensions parameter did not get set,
    here is what I see:

    /usr/bin/php -c
    /var/folders/q6/44cl7bwn1blfrxchzns459rh0000gp/T/zend_debu
    g/session3952346344543095394.tmp -d asp_tags=off
    /Applications/eclipse/plugins/org.phpsrc.eclipse.pti.tools.codesni
    ffer_1.3.0.R20111119000000/php/tools/phpcs.php --report=xml
    --
    standard=/Users/barnettech/drush/drupalcs/DrupalCodingStand
    ard
    /Users/barnettech/Sites/belldev/git/dev/babsoncomm/docroot/si
    tes/all/modules/custom/folder_timerelease/folder_timerelease.
    module
    <?xml version="1.0" encoding="UTF-8"?>
    <phpcs version="1.3.2">
    </phpcs>


    So I did some digging. If I insert these lines on lines 424 and
    425 of
    /Users/barnettech/pear/share/pear/PHP/CodeSniffer/CLI.php

    $the_extensions = 'php,module';
    $values['extensions'] = explode(',', $the_extensions);
    Then it will start examining files with both php and module as an
    extension.

    I just confirmed that the only thing in variable $arg when public
    function processLongArgument($arg, $pos, $values) gets called
    is:
    "standard=/Users/barnettech/drush/drupalcs/DrupalCodingStan
    dard" (that function is in the CLI.php file mentioned above). So
    the extensions parameter is never getting set.

    This bug was discussed in drupal forum:
    http://drupal.org/node/1414902

    Expected result:
    ----------------
    I would have expected to be able to run CodeSniffer on any file
    extension that I specify

    Actual result:
    --------------
    The actual result is even if you specify valid extensions it only
    works with files with extension php.

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


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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedFeb 3, '12 at 5:21p
activeFeb 10, '12 at 9:35p
posts4
users3
websitepear.php.net

3 users in discussion

Gsherwood: 2 posts Info: 1 post Das_peter: 1 post

People

Translate

site design / logo © 2022 Grokbase