Re: Bug #14967 [Opn->Fbk]: Include existing code stand doesn't work
| From: | Charlie Cheng | Date: | Thu, 13 Nov 2008 22:37:57 +0000 |
| Subject: | Re: Bug #14967 [Opn->Fbk]: Include existing code stand doesn't work | ||
| References: | 1 2 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-4995@lists.php.net to get a copy of this message | ||
Hi,
Thanks a lot for that. It work for me when I am using the following command
line:
phpcs
--standard=/home/developer/public_html/ics_misc_fixes/dev_tools/code_sniffer/IcsStandard/
-v ics_con.php3
But I do think it is more proper to support relative path. My point is that
Most people will work with different projects for the same system at
the same time. They are in different directory. And it is tedious to put
full path every time to do testing.
Thanks
Charlie
On Fri, Nov 14, 2008 at 9:22 AM, PEAR Bug Database <pear-qa@lists.php.net>wrote:
> ATTENTION! Do NOT reply to this email!
> To reply, use the web interface found at
> http://pear.php.net/bugs/bug.php?id=14967&edit=2
>
>
> ID: 14967
> Updated by: gsherwood@squiz.net
> Reported By: charlie at 8opus dot com
> Summary: Include existing code stand doesn't work
> -Status: Open
> +Status: Feedback
> Type: Bug
> Package: PHP_CodeSniffer
> Operating System: Debian
> Package Version: 1.1.0
> PHP Version: 5.2.0
> -Assigned To:
> +Assigned To: squiz
> New Comment:
>
> Try using the full path to your coding standard dir instead of a
> relative path.
>
>
> Previous Comments:
> ------------------------------------------------------------------------
>
> [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.
>
> ------------------------------------------------------------------------
>
>
>