Created
March 26, 2013 13:01
-
-
Save mageekguy/5245178 to your computer and use it in GitHub Desktop.
Configruation file to generate atoum treemap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use | |
mageekguy\atoum\scripts\treemap, | |
mageekguy\atoum\scripts\treemap\analyzers, | |
mageekguy\atoum\scripts\treemap\categorizer | |
; | |
class commit implements treemap\analyzer | |
{ | |
public function getMetricName() | |
{ | |
return 'commits'; | |
} | |
public function getMetricLabel() | |
{ | |
return 'Commits'; | |
} | |
public function getMetricFromFile(\splFileInfo $file) | |
{ | |
$commit = exec('git log --pretty=oneline ' . escapeshellarg($file->getRealpath()) . ' | wc -l'); | |
return (int) trim($commit); | |
} | |
} | |
$script | |
->addAnalyzer(new analyzers\token()) | |
->addAnalyzer(new analyzers\size()) | |
->addAnalyzer(new analyzers\sloc()) | |
->addAnalyzer(new commit()) | |
; | |
$testsDirectory = __DIR__ . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR; | |
$testsCategorizer = new categorizer('Tests'); | |
$testsCategorizer | |
->setMinDepthColor('#aae6ff') | |
->setMaxDepthColor('#000f50') | |
->setCallback(function($file) use ($testsDirectory) { return (substr($file->getFilename(), -4) == '.php' && strpos($file->getRealpath(), $testsDirectory) === 0); }) | |
; | |
$phpCategorizer = new categorizer('Code'); | |
$phpCategorizer | |
->setMinDepthColor('#ffaac6') | |
->setMaxDepthColor('#50001b') | |
->setCallback(function($file) { return (substr($file->getFilename(), -4) == '.php'); }) | |
; | |
$script | |
->addCategorizer($testsCategorizer) | |
->addCategorizer($phpCategorizer) | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment