Skip to content

Commit 4aee112

Browse files
authored
Merge pull request #420 from phpmetrics/416_improved_pagerank
Improved page rank report, and UI #416
2 parents 25cae49 + 5213ad6 commit 4aee112

File tree

8 files changed

+42
-15
lines changed

8 files changed

+42
-15
lines changed

templates/html_report/complexity.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<?php
7272
foreach ($classes as $class) { ?>
7373
<tr>
74-
<td><?php echo $class['name']; ?></td>
74+
<td><span class="path"><?php echo $class['name']; ?></span></td>
7575
<td><?php echo isset($class['wmc']) ? $class['wmc'] : ''; ?></td>
7676
<td><?php echo isset($class['ccn']) ? $class['ccn'] : ''; ?></td>
7777
<td><?php echo isset($class['ccnMethodMax']) ? $class['ccnMethodMax'] : ''; ?></td>
@@ -91,4 +91,4 @@
9191
</div>
9292

9393

94-
<?php require __DIR__ . '/_footer.php'; ?>
94+
<?php require __DIR__ . '/_footer.php'; ?>

templates/html_report/coupling.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<tbody>
2424
<?php foreach ($classes as $class) { ?>
2525
<tr>
26-
<td><?php echo $class['name']; ?></td>
26+
<td><span class="path"><?php echo $class['name']; ?></span></td>
2727
<td><?php echo isset($class['afferentCoupling']) ? $class['afferentCoupling'] : ''; ?></td>
2828
<td><?php echo isset($class['efferentCoupling']) ? $class['efferentCoupling'] : ''; ?></td>
2929
<td><?php echo isset($class['instability']) ? $class['instability'] : ''; ?></td>

templates/html_report/css/style.css

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ a {
173173
.page .content {
174174
padding: 2em 2em;
175175
position:relative;
176+
margin-top: 80px;
176177
}
177178
.report-details {
178179
position: absolute;
@@ -304,6 +305,13 @@ a {
304305
background-color: #F44336;
305306
color: #FFF;
306307
}
308+
.path {
309+
font-family: "Menlo", "Consolas", "Bitstream Vera Sans Mono", "DejaVu Sans Mono", "Monaco", monospace;
310+
color: #2f855a;
311+
background-color: #f0fff4;
312+
display: inline-block;
313+
padding: 1px 4px;
314+
}
307315

308316

309317

@@ -338,10 +346,13 @@ a {
338346
background-color: #fff;
339347
height:100%;
340348
}
341-
.column.help {
349+
.help {
342350
padding-left:0;
343351
color: #999;
344352
font-size: 0.8em;
353+
text-align: left;
354+
}
355+
.column.help {
345356
align-items: stretch;
346357
display: flex;
347358
}
@@ -429,6 +440,10 @@ a {
429440
}
430441

431442
/* -------- Table ------------ */
443+
table tr td {
444+
border:none;
445+
padding: 4px 0;
446+
}
432447
#table-length tbody {
433448
font-size: 0.8em;
434449
}

templates/html_report/index.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,22 @@
9494
<div class="column">
9595
<div class="bloc bloc-number">
9696
<div class="label">ClassRank
97-
<small>(Google's page rank applied to relations between classes)</small>
97+
<small>(<a href="https://en.wikipedia.org/wiki/PageRank" target="_blank">Google's page rank applied to relations between classes)</a></small>
98+
</div>
99+
<div class="help">
100+
<div class="help-inner">
101+
<p>
102+
Page Rank is a way to measure de importance of a class. There is no "good" or "bad" page rank. This metrics reflects interactions in your code.
103+
</p>
104+
</div>
98105
</div>
99106
<div class="clusterize small">
100107
<div id="clusterizeClassRank" class="clusterize-scroll">
101-
<table>
108+
<table class="table-small">
102109
<thead>
103110
<tr>
104-
<th>Class</th>
105111
<th>ClassRank</th>
112+
<th></th>
106113
</tr>
107114
</thead>
108115
<tbody id="contentClassRank" class="clusterize-content">
@@ -114,7 +121,9 @@
114121
//$classesS = array_slice($classesS, 0, 10);
115122
foreach ($classesS as $class) { ?>
116123
<tr>
117-
<td><?php echo $class['name']; ?>
124+
<td><?php echo $class['pageRank']; ?></td>
125+
<td>
126+
<span class="path"><?php echo $class['name']; ?></span>
118127
<?php
119128
$badgeTitleMIWOC = 'Maintainability Index (w/o comments)';
120129
$mIwoC = isset($class['mIwoC']) ? $class['mIwoC'] : '';
@@ -124,7 +133,6 @@
124133
<span class="badge" title="<?php echo $badgeTitleMI;?>"><?php echo $mi;?></span>
125134
<span class="badge" title="<?php echo $badgeTitleMIWOC;?>"><?php echo $mIwoC;?></span>
126135
</td>
127-
<td><?php echo $class['pageRank']; ?></td>
128136
</tr>
129137
<?php } ?>
130138
</tbody>

templates/html_report/loc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function percentile($arr, $percentile = 0.95)
6060
<?php
6161
foreach ($classes as $class) { ?>
6262
<tr>
63-
<td><?php echo $class['name']; ?></td>
63+
<td><span class="path"><?php echo $class['name']; ?></span></td>
6464
<td><?php echo isset($class['lloc']) ? $class['lloc'] : ''; ?></td>
6565
<td><?php echo isset($class['cloc']) ? $class['cloc'] : ''; ?></td>
6666
<td><?php echo isset($class['volume']) ? $class['volume'] : ''; ?></td>

templates/html_report/oop.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<?php
7575
foreach ($classes as $class) { ?>
7676
<tr>
77-
<td><?php echo $class['name']; ?></td>
77+
<td><span class="path"><?php echo $class['name']; ?></span></td>
7878
<td><?php echo isset($class['lcom']) ? $class['lcom'] : ''; ?></td>
7979
<td><?php echo isset($class['volume']) ? $class['volume'] : ''; ?></td>
8080
<td><?php echo isset($class['ccn']) ? $class['ccn'] : ''; ?></td>
@@ -89,4 +89,4 @@
8989
</div>
9090

9191

92-
<?php require __DIR__ . '/_footer.php'; ?>
92+
<?php require __DIR__ . '/_footer.php'; ?>

templates/html_report/packages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<?php
2626
foreach ($packages as $package) { ?>
2727
<tr>
28-
<td><?= $package['name'] === '\\' ? 'global' : substr($package['name'], 0, -1); ?></td>
28+
<td><span class="path"><?= $package['name'] === '\\' ? 'global' : substr($package['name'], 0, -1); ?></span></td>
2929
<td><?= $package['classes'] ? count($package['classes']) : 0; ?></td>
3030
<td><?= isset($package['abstraction']) ? round($package['abstraction'], 3) : ''; ?></td>
3131
<td><?= isset($package['instability']) ? round($package['instability'], 3) : ''; ?></td>

templates/html_report/violations.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@
6262

6363
<tr>
6464
<td>
65-
<a onclick="return toggle('<?php echo $currentId; ?>');"><?php echo $class['name']; ?></a>
65+
<a onclick="return toggle('<?php echo $currentId; ?>');">
66+
<span class="path"><?php echo $class['name']; ?></span>
67+
</a>
6668
<div class="violation-list" id="<?php echo $currentId; ?>">
6769
<?php foreach ($class['violations'] as $violation) { ?>
6870
<div class="violation">
@@ -113,7 +115,9 @@ class="badge level level-<?php echo $map[$violation->getLevel()]; ?>"> <?php ech
113115

114116
<tr>
115117
<td>
116-
<a onclick="return toggle('<?php echo $currentId; ?>');"><?php echo substr($package['name'], 0, -1); ?></a>
118+
<a onclick="return toggle('<?php echo $currentId; ?>');">
119+
<span class="path"><?php echo substr($package['name'], 0, -1); ?></span>
120+
</a>
117121
<div class="violation-list" id="<?php echo $currentId; ?>">
118122
<?php foreach ($package['violations'] as $violation) { ?>
119123
<div class="violation">

0 commit comments

Comments
 (0)