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

Bug #15091 pre-commit hook attempts to sniff folders
Submitted: 2008-11-19 18:33 UTC
From: weirdan Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.1.0)
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2008-11-19 18:33 UTC] weirdan (Bruce Weirdan)
Description: ------------ There is a problem in pre-commit hook - it does not check if the path it reads from 'svnlook changed' output refers to directory. The problem is fixed in the attached patch. Test script: --------------- weirdan@virtual-debian:~/public_html/project/trunk$ mkdir testdir weirdan@virtual-debian:~/public_html/project/trunk$ echo "qwe" > testdir/qwe.php weirdan@virtual-debian:~/public_html/project/trunk$ svn add testdir A testdir A testdir/qwe.php weirdan@virtual-debian:~/public_html/project/trunk$ svn ci -m "test sniff" testdir Adding testdir Adding testdir/qwe.php Transmitting file data .svn: Commit failed (details follow): svn: 'pre-commit' hook failed with error output: svnlook: Path 'trunk/testdir' is not a file sh: line 1: trunk/testdir/qwe.php: No such file or directory Fatal error: Uncaught PHP_CodeSniffer_Exception: Could not auto-detect line endings from content in /home/svn/CodeSniffer/CodeSniffer/File.php on line 412 #0 /home/svn/CodeSniffer/CodeSniffer/File.php(412): PHP_CodeSniffer_File::detectLineEndings('trunk/testdir/?...', '') #1 /home/svn/CodeSniffer/CodeSniffer/File.php(343): PHP_CodeSniffer_File->_parse('') #2 /home/svn/CodeSniffer/CodeSniffer.php(624): PHP_CodeSniffer_File->start('') #3 /home/svn/CodeSniffer/scripts/phpcs-svn-pre-commit(150): PHP_CodeSniffer->processFile('trunk/testdir/?...', '') #4 /home/svn/CodeSniffer/scripts/phpcs-svn-pre-commit(183): PHP_CodeSniffer_SVN_Hook->process() #5 {main} thrown in /home/svn/CodeSniffer/CodeSniffer/File.php on line 485 Expected result: ---------------- folder should not be sniffed, but file should be. Actual result: -------------- Adding testdir Adding testdir/qwe.php Transmitting file data .svn: Commit failed (details follow): svn: 'pre-commit' hook failed with error output: svnlook: Path 'trunk/testdir' is not a file Fatal error: Uncaught PHP_CodeSniffer_Exception: Could not auto-detect line endings from content in /home/svn/CodeSniffer/CodeSniffer/File.php on line 412 #0 /home/svn/CodeSniffer/CodeSniffer/File.php(412): PHP_CodeSniffer_File::detectLineEndings('trunk/testdir/', '') #1 /home/svn/CodeSniffer/CodeSniffer/File.php(343): PHP_CodeSniffer_File->_parse('') #2 /home/svn/CodeSniffer/CodeSniffer.php(624): PHP_CodeSniffer_File->start('') #3 /home/svn/CodeSniffer/scripts/phpcs-svn-pre- commit(152): PHP_CodeSniffer->processFile('trunk/testdir/', '') #4 /home/svn/CodeSniffer/scripts/phpcs-svn-pre- commit(185): PHP_CodeSniffer_SVN_Hook->process() #5 {main} thrown in /home/svn/CodeSniffer/CodeSniffer/File.php on line 485

Comments

 [2008-11-24 05:39 UTC] squiz (Greg Sherwood)
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.