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

ID: 14967
Updated by: gsherwood@squiz.net
Reported By: charlie at 8opus dot com
Summary: Allow relative paths to specify location of custom
coding standards
-Status: Assigned
+Status: Closed
Type: Feature/Change Request
Package: PHP_CodeSniffer
Operating System: Debian
Package Version: 1.1.0
PHP Version: 5.2.0
Assigned To: squiz
Roadmap Versions:
New Comment:

-Status: Assigned
+Status: Closed
This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on
pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should
be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

You can now use a relative path. You get output like:

gsherwood$ phpcs --standard=Ics temp.php -v
Registering sniffs in Ics standard... DONE (130 sniffs registered)
Processing temp.php [31 tokens in 8 lines]... DONE in < 1 second (3
errors, 0 warnings)


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

[2008-11-13 17:58:19] squiz

Turning this into a feature request to be able to use relative paths
for custom standards.

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

[2008-11-13 17:22:31] squiz

Try using the full path to your coding standard dir instead of a
relative path.

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

[2008-11-06 19:30:11] chalia

Description:
------------
I have a class as following:

<?php
if (class_exists('PHP_CodeSniffer_Standards_CodingStandard', true) ===
false) {
throw new PHP_CodeSniffer_Exception('Class
PHP_CodeSniffer_Standards_CodingStandard not found');
}

class PHP_CodeSniffer_Standards_IcsStandard_IcsStandardCodingStandard
extends PHP_CodeSniffer_Standards_CodingStandard
{

public function getIncludedSniffs()
{
return array(
'MySource',
);

}//end getIncludedSniffs()

public function getExcludedSniffs()
{
return array();
}
}//end class
?>

When I run command line as following:

phpcs --standard=dev_tools/code_sniffer/IcsStandard/ -v ics_con.php3

The screen shows:

Registering sniffs in dev_tools/code_sniffer/IcsStandard/ standard...
DONE (0 sniffs registered)
Processing ics_con.php3 [1171 tokens in 226 lines]... DONE in < 1
second (0 errors, 0 warnings)

And I have tried to run command line as following to compare:

phpcs --standard=MySource ics_con.php3

The message was shown as following:

FILE: /home/developer/public_html/ics_misc_fixes/ics_con.php3
--------------------------------------------------------------------------------
FOUND 361 ERROR(S) AND 42 WARNING(S) AFFECTING 170 LINE(S)
--------------------------------------------------------------------------------

...


My guess will be the override of function getIncludedSniffs doesn't
work.


Test script:
---------------
<?php
if (class_exists('PHP_CodeSniffer_Standards_CodingStandard', true) ===
false) {
throw new PHP_CodeSniffer_Exception('Class
PHP_CodeSniffer_Standards_CodingStandard not found');
}

class PHP_CodeSniffer_Standards_IcsStandard_IcsStandardCodingStandard
extends PHP_CodeSniffer_Standards_CodingStandard
{

public function getIncludedSniffs()
{
return array(
'MySource',
);

}//end getIncludedSniffs()

public function getExcludedSniffs()
{
return array();
}
}//end class
?>

Expected result:
----------------
There should have some warning message shown and in the same time,
registered sniffs should not be zero.

Actual result:
--------------
registered sniffs is zero. And no warning message is given.

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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
grouppear-bugs @
categoriesphp
postedJul 6, '09 at 1:55a
activeJul 6, '09 at 1:55a
posts1
users1
websitepear.php.net

1 user in discussion

Gsherwood: 1 post

People

Translate

site design / logo © 2022 Grokbase