Bug #19246 [Com]: In Eclipse CodeSniffer drops the extensions paramater
| From: | info@das-peter.ch | Date: | Fri, 10 Feb 2012 16:15:14 +0000 |
| Subject: | Bug #19246 [Com]: In Eclipse CodeSniffer drops the extensions paramater | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-8262@lists.php.net to get a copy of this message | ||
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