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

Request #17606 Add a new percentage col in svn and gitblame reports
Submitted: 2010-07-18 00:34 UTC
From: sebastian Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.3.0a1)
PHP Version: 5.3.2 OS: Not relevant
Roadmaps: (Not assigned)    
Subscription  


 [2010-07-18 00:34 UTC] sebastian (Sebastian Bergmann)
Description: ------------ See expected/actual output Expected result: ---------------- sb@thinkpad phpunit % phpcs --standard=Sebastian --report=gitblame PHPUnit PHP CODE SNIFFER GIT BLAME SUMMARY -------------------------------------------------------------------------------- AUTHOR COUNT (%) -------------------------------------------------------------------------------- Sebastian Bergmann 24 (100) -------------------------------------------------------------------------------- A TOTAL OF 24 SNIFF VIOLATION(S) WERE COMMITTED BY 1 AUTHOR(S) -------------------------------------------------------------------------------- Time: 01:17, Memory: 20.25Mb Actual result: -------------- sb@thinkpad phpunit % phpcs --standard=Sebastian --report=gitblame PHPUnit PHP CODE SNIFFER GIT BLAME SUMMARY -------------------------------------------------------------------------------- AUTHOR COUNT (%) -------------------------------------------------------------------------------- Sebastian Bergmann 24 (0.09) -------------------------------------------------------------------------------- A TOTAL OF 24 SNIFF VIOLATION(S) WERE COMMITTED BY 1 AUTHOR(S) -------------------------------------------------------------------------------- Time: 01:17, Memory: 20.25Mb

Comments

 [2010-07-18 02:39 UTC] benmatselby (Ben Selby)
As I understand it, this is actually correct, and works as the Svnblame report works. The percentage represents all of the work committed by an author on a good/bad ratio and not the percentage of all warnings/errors.. So in the example you used the 'author' has these stats: Array ( [Sebastian Bergmann] => Array ( [good] => 26437 [bad] => 24 ) ) (24/26437) * 100 = 0.09 (rounded to two decimal places). If I run the gitblame and svnblame side by side for the Gitblame.php file I get this: $ php ~/Development/PHP_CodeSniffer/scripts/phpcs --report=svnblame Gitblame.php PHP CODE SNIFFER SVN BLAME SUMMARY -------------------------------------------------------------------------------- AUTHOR COUNT (%) -------------------------------------------------------------------------------- squiz 5 (1.92) -------------------------------------------------------------------------------- A TOTAL OF 5 SNIFF VIOLATION(S) WERE COMMITTED BY 1 AUTHOR(S) -------------------------------------------------------------------------------- Time: 2 seconds, Memory: 7.25Mb $ php ~/Development/PHP_CodeSniffer/scripts/phpcs --report=gitblame Gitblame.php PHP CODE SNIFFER GIT BLAME SUMMARY -------------------------------------------------------------------------------- AUTHOR COUNT (%) -------------------------------------------------------------------------------- squiz 5 (1.92) -------------------------------------------------------------------------------- A TOTAL OF 5 SNIFF VIOLATION(S) WERE COMMITTED BY 1 AUTHOR(S) -------------------------------------------------------------------------------- Time: 1 second, Memory: 7.25Mb Maybe the description could explain this better?
 [2010-07-18 04:26 UTC] sebastian (Sebastian Bergmann)
That makes sense. However, I think the current label is confusing. And the percentage I meant it was supposed to be also makes sense. There should be two data points per committer: percentage of violations by this developer and percentage of lines that are in violation committed by this developer.
 [2010-07-18 06:26 UTC] squiz (Greg Sherwood)
-Summary: Percentage in gitblame report is wrongy +Summary: Add a new percentage col in svn and gitblame reports -Type: Bug +Type: Feature/Change Request -Assigned To: +Assigned To: squiz
Yes, Ben is correct. Behaviour is documented under the SVN report here: http://pear.php.net/manual/en/package.php.php-codesniffer.reporting.php The idea is not to get too angry at a particular developer for having a high count because they commit so much code, while someone who always commits errors but has a low amount of code committed will show a high percentage even if it shows a lower error count. I'll leave this as a feature request to potentially add another column.
 [2010-07-18 22:23 UTC] benmatselby (Ben Selby)
 [2010-07-18 22:25 UTC] benmatselby (Ben Selby)
I've added a patch for this: - Removed duplicate code from Gitblame and Svnblame and placed into VersionControl.php - Added extra column (Overall %) which gives the percentage of errors for all developers in the report. So in the case above that Sebastian mentioned he would get 100%.
 [2010-07-19 06:04 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
Another great patch. Thanks a lot. Report now has Author % and Overall % columns.