Skip to content

Commit d4ff35e

Browse files
authored
Merge pull request #229 from Webysther/fix/column-size
Format to use less space column
2 parents 88ec997 + 65d6481 commit d4ff35e

File tree

2 files changed

+49
-20
lines changed

2 files changed

+49
-20
lines changed

build/phpmetrics.phar

122 KB
Binary file not shown.

src/Hal/Application/Formater/Details/Cli.php

Lines changed: 49 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use Hal\Component\Result\ResultCollection;
1717
use Symfony\Component\Console\Output\BufferedOutput;
1818
use Symfony\Component\Console\Output\OutputInterface;
19+
use Symfony\Component\Console\Helper\TableCell;
20+
use Symfony\Component\Console\Helper\TableSeparator;
1921

2022

2123
/**
@@ -84,36 +86,63 @@ public function terminate(ResultCollection $collection, ResultCollection $groupe
8486

8587
$hasOOP = null !== $total->getSum('instability');
8688

89+
$output->writeln('1 - Complexity');
90+
$output->writeln('2 - Myer Distance: derivated from Cyclomatic complexity');
91+
$output->writeln('3 - Maintainability');
92+
$output->writeln('4 - LLOC: Number of logical lines of code');
93+
$output->writeln('5 - Comment weight: measure the ratio between logical code and comments');
94+
$output->writeln('6 - Vocabulary used in code');
95+
$output->writeln('7 - Volume');
96+
$output->writeln('8 - Bugs: Number of estimated bugs by file');
97+
$output->writeln('9 - Difficulty of the code');
98+
$output->writeln('A - LCOM: Lack of cohesion of methods measures the cohesiveness of a class');
99+
$output->writeln('B - System complexity');
100+
$output->writeln('C - Instability: Indicates the class is resilience to change');
101+
$output->writeln('D - Abstractness: Number of abstract classes');
102+
$output->writeln('E - Efferent coupling (CE): Number of classes that the class depend');
103+
$output->writeln('F - Afferent coupling (CA): Number of classes affected by this class');
104+
105+
$output->writeln('');
106+
107+
$output->writeln('More details about metrics: http://www.phpmetrics.org/documentation/index.html');
108+
87109
$table = new \Symfony\Component\Console\Helper\Table($output);
88110
$table
89111
->setHeaders(array_merge(
90112
array(
91-
'Name'
92-
, 'Complexity'
93-
, 'Myer Distance'
94-
, 'Maintainability'
95-
, 'LLOC'
96-
, 'Comment weight'
97-
, 'Vocabulary'
98-
, 'Volume'
99-
, 'Bugs'
100-
, 'Difficulty'
113+
'1'
114+
, '2'
115+
, '3'
116+
, '4'
117+
, '5'
118+
, '6'
119+
, '7'
120+
, '8'
121+
, '9'
101122
)
102123
, ($hasOOP ? array(
103-
'lcom'
104-
, 'SysComplexity'
105-
, 'Instability'
106-
, 'Abstractness'
107-
, 'ce'
108-
, 'ca'
124+
'A'
125+
, 'B'
126+
, 'C'
127+
, 'D'
128+
, 'E'
129+
, 'F'
109130
) : array())
110131
));
111132

112-
foreach($groupedResults as $result) {
133+
foreach($groupedResults as $key => $result) {
134+
if($result->getDepth()>1){
135+
$table->addRow(new TableSeparator());
136+
}
137+
138+
$table->addRow(array(
139+
new TableCell($result->getName(), array('colspan' => 15))
140+
)
141+
);
142+
$table->addRow(new TableSeparator());
143+
113144
$table->addRow(array_merge(
114-
array(
115-
str_repeat(' ', $result->getDepth()).$result->getName()
116-
, $this->getRow($result->getBounds(), 'cyclomaticComplexity', 'average', 0)
145+
array($this->getRow($result->getBounds(), 'cyclomaticComplexity', 'average', 0)
117146
, $this->getRow($result->getBounds(), 'myerDistance', 'average', 0)
118147
, $this->getRow($result->getBounds(), 'maintainabilityIndex', 'average', 0)
119148
, $this->getRow($result->getBounds(), 'logicalLoc', 'sum', 0)

0 commit comments

Comments
 (0)