FAQ
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: Open
+Status: Feedback
Type: Bug
Package: PHP_CodeSniffer
Operating System: Mac
Package Version: 1.3.2
PHP Version: 5.3.1
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:

-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.


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

[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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJan 29, '12 at 9:51p
activeJan 29, '12 at 9:51p
posts1
users1
websitepear.php.net

1 user in discussion

Gsherwood: 1 post

People

Translate

site design / logo © 2022 Grokbase