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

Bug #20131 PHP errors in svnblame report, if there are files not under version control.
Submitted: 2013-11-20 15:31 UTC
From: happydog Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.4.7)
PHP Version: Irrelevant OS: N/A
Roadmaps: (Not assigned)    
Subscription  


 [2013-11-20 15:31 UTC] happydog (Mark Clements)
Description: ------------ If you do an svnblame report on a working that contains some files that are not version controlled then CodeSniffer will throw the following PHP errors. Notice: Undefined offset: 2 in ~/CodeSniffer/Reports/VersionControl.php on line 68 Notice: Undefined offset: 6 in ~/CodeSniffer/Reports/VersionControl.php on line 68 When I encountered this, there was only one such file, so I don't know whether the errors are thrown just once, or repeatedly for each non-versioned file. Expected result: ---------------- No PHP notices are generated. Ideally, the report would include 'unversioned files' in the output, so that these aren't simply omitted from the result. However, it is not necessary to implement that feature in order to mark this bug as resolved. If this bug gets resolved without this feature, it should be logged as a separate feature-request ticket.

Comments

 [2013-11-25 06:00 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
I've fixed it here: https://github.com/squizlabs/PHP_CodeSniffer/commit/9814996ff90bdf44acb160f7e 081070f12ef2e86 As this report is only showing author information, there is no way to show files that are not under version control. Instead, I've listed errors that can't be attributed to an author under an "Unknown" author line. SVN will show an error line for each file it couldn't check for whatever reason. Here is some example output: $phpcs --report=svnblame CodeSniffer -l svn: E155007: '.../CodeSniffer/Autoload.php' is not a working copy svn: E155007: '.../CodeSniffer/CLI.php' is not a working copy svn: E155007: '.../CodeSniffer/Exception.php' is not a working copy svn: E155007: '.../CodeSniffer/File.php' is not a working copy svn: E155007: '.../CodeSniffer/MultiFileSniff.php' is not a working copy svn: E155007: '.../CodeSniffer/Report.php' is not a working copy svn: E155007: '.../CodeSniffer/Reporting.php' is not a working copy svn: E155007: '.../CodeSniffer/Sniff.php' is not a working copy svn: E155007: '.../CodeSniffer/Tokens.php' is not a working copy PHP CODE SNIFFER SVN BLAME SUMMARY -------------------------------------------------------------------------------- AUTHOR (Author %) (Overall %) COUNT -------------------------------------------------------------------------------- Unknown (92.66) (100) 101 -------------------------------------------------------------------------------- A TOTAL OF 101 SNIFF VIOLATION(S) WERE COMMITTED BY 1 AUTHOR(S) -------------------------------------------------------------------------------- Time: 1.02 seconds, Memory: 28.00Mb
 [2014-02-15 06:58 UTC] happydog (Mark Clements)
I will need to play with this a bit to understand properly what it's doing/showing, but it looks like it should resolve the issue. If I have any further questions/issues I will get back to you here or via a new ticket (whichever seems to make most sense), so if you don't hear anything else, assume all is fine! Thank you for your work on this.