Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.4.2

Bug #16736 Multi-files sniffs aren't processed when <file> is a single directory
Submitted: 2009-10-25 00:18 UTC
From: conf Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.2.0)
PHP Version: 5.2.6 OS: Ubuntu Linux 9.04 x86_64
Roadmaps: (Not assigned)    
Subscription  


 [2009-10-25 00:18 UTC] conf (Alexey Shein)
Description: ------------ When invoking phpcs command like this $ phpcs --standard=SampleStandard /path/to/directory/ multi-files sniffs are skipped. Test case is included in the bug report. Test script: --------------- Use attached test case as shown below: $ tar -xvzf phpcs-test.tar.gz $ cd phpcs-test/ $ phpcs --standard=Test . Expected result: ---------------- FILE: /home/conf/phpcs-test/test1.php -------------------------------------------------------------------------------- FOUND 0 ERROR(S) AND 1 WARNING(S) AFFECTING 1 LINE(S) -------------------------------------------------------------------------------- 3 | WARNING | Duplicate class name "Test" found; first defined in | | /home/conf/phpcs-test/test2.php on line 3 -------------------------------------------------------------------------------- Actual result: -------------- No errors.

Comments

 [2009-10-25 00:23 UTC] conf (Alexey Shein)
 [2009-10-25 00:39 UTC] conf (Alexey Shein)
-PHP Version: 5.2.5 +PHP Version: 5.2.6
Sorry, I'm new to PEAR bug tracking system, so I didn't knew that it's unable to upload archives. So, let's manually create test case: 1. Create the following directory structure: conf@avalon:/tmp$ tree -a phpcs-test phpcs-test |-- Test | `-- TestCodingStandard.php |-- test1.php `-- test2.php 1 directory, 3 files 2. File TestCodingStandard.php contains: <?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_Test_TestCodingStandard extends PHP_CodeSniffer_Standards_CodingStandard { /** * Return a list of external sniffs to include with this standard. * * The PHP_CodeSniffer standard combines the PEAR and Squiz standards * but removes some sniffs from the Squiz standard that clash with * those in the PEAR standard. * * @return array */ public function getIncludedSniffs() { return array( 'Generic/Sniffs/Classes/DuplicateClassNameSniff.php' ); }//end getIncludedSniffs() }//end class ?> 3. Files test1.php and test2.php are identical and contain the following: <?php class Test {} 4. Go to phpcs-test dir and run the command: $ phpcs --standard=Test . 5. Expected and actual result described in description.
 [2009-11-16 12:06 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
This bug has been fixed in SVN. 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. Thanks for such a detailed report and a working patch.