Completed
Push — master ( 7a3fe6...3dd71e )
by Richard
04:22
created

diff_per_rule.php ➔ template_diff_per_rule()   B

Complexity

Conditions 3
Paths 3

Size

Total Lines 33
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 20
nc 3
nop 1
dl 0
loc 33
ccs 1
cts 1
cp 1
crap 3
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
function template_diff_per_rule(array $report) {
4
?>
5
6
====================================================================================
7
 DICTO - automated architectural tests     (https://github.com/lechimp-p/dicto.php)
8
====================================================================================
9
 report with emphasis on the diff
10
11
 commit      : <?= $report["current"]["commit_hash"] ?> 
12
 compared to : <?= $report["previous"]["commit_hash"] ?> 
13
14
 violations
15
    total    : <?= $report["violations"]["total"] ?> 
16
    added    : <?= $report["violations"]["added"] ?> 
17
    resolved : <?= $report["violations"]["resolved"] ?> 
18
19
<?php foreach ($report["rules"] as $rule) { ?>
20
------------------------------------------------------------------------------------
21
 (!) <?= wordwrap($rule["rule"], 80, "\n     ", true) ?> 
22
------------------------------------------------------------------------------------
23
 <?= wordwrap(str_replace("\n", " ", $rule["explanation"]), 80, "\n ", false); ?> 
24
25
 violations
26
    total    : <?= $rule["violations"]["total"] ?> 
27
    added    : <?= $rule["violations"]["added"] ?> 
28
    resolved : <?= $rule["violations"]["resolved"] ?> 
29
30
<?php   foreach ($rule["violations"]["list"] as $v) { ?>
31
    <?= $v["file"] ?> (l. <?= $v["line_no"] ?>)
32
<?php   } ?>
33
34
<?php }
35
}
36