Skip to content

Commit

Permalink
added Workbench
Browse files Browse the repository at this point in the history
  • Loading branch information
TomHAnderson committed Oct 29, 2024
1 parent 59c8858 commit 3afda37
Show file tree
Hide file tree
Showing 71 changed files with 10,145 additions and 12 deletions.
27 changes: 23 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"mockery/mockery": "^1.6",
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpstan/phpstan": "^1.12",
"phpunit/phpunit": "^11.4"
"phpunit/phpunit": "^11.4",
"orchestra/testbench": "^9.5"
},
"suggest": {
"gedmo/doctrine-extensions": "Behavioral Doctrine2 extensions",
Expand All @@ -50,7 +51,10 @@
},
"autoload-dev": {
"psr-4": {
"LaravelDoctrineTest\\Extensions\\": "tests/"
"LaravelDoctrineTest\\Extensions\\": "tests/",
"Workbench\\App\\": "workbench/app/",
"Workbench\\Database\\Factories\\": "workbench/database/factories/",
"Workbench\\Database\\Seeders\\": "workbench/database/seeders/"
}
},
"scripts": {
Expand All @@ -60,11 +64,26 @@
"vendor/bin/phpunit",
"vendor/bin/phpstan analyze src --level 1"
],
"coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-html=coverage"
"coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-html=coverage",
"post-autoload-dump": [
"@clear",
"@prepare"
],
"clear": "@php vendor/bin/testbench package:purge-skeleton --ansi",
"prepare": "@php vendor/bin/testbench package:discover --ansi",
"build": "@php vendor/bin/testbench workbench:build --ansi",
"serve": [
"Composer\\Config::disableProcessTimeout",
"@build",
"@php vendor/bin/testbench serve --ansi"
],
"lint": [
"@php vendor/bin/phpstan analyse --verbose --ansi"
]
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
}
277 changes: 277 additions & 0 deletions coverage/BeberleiExtensionsServiceProvider.php.html

Large diffs are not rendered by default.

204 changes: 204 additions & 0 deletions coverage/Blameable/BlameableExtension.php.html

Large diffs are not rendered by default.

284 changes: 284 additions & 0 deletions coverage/Blameable/dashboard.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dashboard for /Users/tom.h.anderson/Projects/laravel-doctrine/extensions/src/Blameable</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="../_css/bootstrap.min.css?v=11.0.7" rel="stylesheet" type="text/css">
<link href="../_css/nv.d3.min.css?v=11.0.7" rel="stylesheet" type="text/css">
<link href="../_css/style.css?v=11.0.7" rel="stylesheet" type="text/css">
<link href="../_css/custom.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="../index.html">/Users/tom.h.anderson/Projects/laravel-doctrine/extensions/src</a></li>
<li class="breadcrumb-item"><a href="index.html">Blameable</a></li>
<li class="breadcrumb-item active">(Dashboard)</li>

</ol>
</nav>
</div>
</div>
</div>
</header>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h2>Classes</h2>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Coverage Distribution</h3>
<div id="classCoverageDistribution" style="height: 300px;">
<svg></svg>
</div>
</div>
<div class="col-md-6">
<h3>Complexity</h3>
<div id="classComplexity" style="height: 300px;">
<svg></svg>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Insufficient Coverage</h3>
<div class="scrollbox">
<table class="table">
<thead>
<tr>
<th>Class</th>
<th class="text-right">Coverage</th>
</tr>
</thead>
<tbody>

</tbody>
</table>
</div>
</div>
<div class="col-md-6">
<h3>Project Risks</h3>
<div class="scrollbox">
<table class="table">
<thead>
<tr>
<th>Class</th>
<th class="text-right"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></th>
</tr>
</thead>
<tbody>

</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h2>Methods</h2>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Coverage Distribution</h3>
<div id="methodCoverageDistribution" style="height: 300px;">
<svg></svg>
</div>
</div>
<div class="col-md-6">
<h3>Complexity</h3>
<div id="methodComplexity" style="height: 300px;">
<svg></svg>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Insufficient Coverage</h3>
<div class="scrollbox">
<table class="table">
<thead>
<tr>
<th>Method</th>
<th class="text-right">Coverage</th>
</tr>
</thead>
<tbody>

</tbody>
</table>
</div>
</div>
<div class="col-md-6">
<h3>Project Risks</h3>
<div class="scrollbox">
<table class="table">
<thead>
<tr>
<th>Method</th>
<th class="text-right"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></th>
</tr>
</thead>
<tbody>

</tbody>
</table>
</div>
</div>
</div>
<footer>
<hr/>
<p>
<small>Generated by <a href="https://github.com/sebastianbergmann/php-code-coverage" target="_top">php-code-coverage 11.0.7</a> using <a href="https://www.php.net/" target="_top">PHP 8.3.4</a> and <a href="https://phpunit.de/">PHPUnit 11.4.3</a> at Tue Oct 29 5:44:58 UTC 2024.</small>
</p>
</footer>
</div>
<script src="../_js/jquery.min.js?v=11.0.7" type="text/javascript"></script>
<script src="../_js/d3.min.js?v=11.0.7" type="text/javascript"></script>
<script src="../_js/nv.d3.min.js?v=11.0.7" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
nv.addGraph(function() {
var chart = nv.models.multiBarChart();
chart.tooltips(false)
.showControls(false)
.showLegend(false)
.reduceXTicks(false)
.staggerLabels(true)
.yAxis.tickFormat(d3.format('d'));

d3.select('#classCoverageDistribution svg')
.datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,0,1], "Class Coverage"))
.transition().duration(500).call(chart);

nv.utils.windowResize(chart.update);

return chart;
});

nv.addGraph(function() {
var chart = nv.models.multiBarChart();
chart.tooltips(false)
.showControls(false)
.showLegend(false)
.reduceXTicks(false)
.staggerLabels(true)
.yAxis.tickFormat(d3.format('d'));

d3.select('#methodCoverageDistribution svg')
.datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,0,2], "Method Coverage"))
.transition().duration(500).call(chart);

nv.utils.windowResize(chart.update);

return chart;
});

function getCoverageDistributionData(data, label) {
var labels = [
'0%',
'0-10%',
'10-20%',
'20-30%',
'30-40%',
'40-50%',
'50-60%',
'60-70%',
'70-80%',
'80-90%',
'90-100%',
'100%'
];
var values = [];
$.each(labels, function(key) {
values.push({x: labels[key], y: data[key]});
});

return [
{
key: label,
values: values,
color: "#4572A7"
}
];
}
nv.addGraph(function() {
var chart = nv.models.scatterChart()
.showDistX(true)
.showDistY(true)
.showLegend(false)
.forceX([0, 100]);
chart.tooltipContent(function(graph) {
return '<p>' + graph.point.class + '</p>';
});

chart.xAxis.axisLabel('Code Coverage (in percent)');
chart.yAxis.axisLabel('Cyclomatic Complexity');

d3.select('#classComplexity svg')
.datum(getComplexityData([[100,2,"<a href=\"BlameableExtension.php.html#13\">LaravelDoctrine\\Extensions\\Blameable\\BlameableExtension<\/a>"]], 'Class Complexity'))
.transition()
.duration(500)
.call(chart);

nv.utils.windowResize(chart.update);

return chart;
});

nv.addGraph(function() {
var chart = nv.models.scatterChart()
.showDistX(true)
.showDistY(true)
.showLegend(false)
.forceX([0, 100]);
chart.tooltipContent(function(graph) {
return '<p>' + graph.point.class + '</p>';
});

chart.xAxis.axisLabel('Code Coverage (in percent)');
chart.yAxis.axisLabel('Method Complexity');

d3.select('#methodComplexity svg')
.datum(getComplexityData([[100,1,"<a href=\"BlameableExtension.php.html#15\">LaravelDoctrine\\Extensions\\Blameable\\BlameableExtension::addSubscribers<\/a>"],[100,1,"<a href=\"BlameableExtension.php.html#26\">LaravelDoctrine\\Extensions\\Blameable\\BlameableExtension::getFilters<\/a>"]], 'Method Complexity'))
.transition()
.duration(500)
.call(chart);

nv.utils.windowResize(chart.update);

return chart;
});

function getComplexityData(data, label) {
var values = [];
$.each(data, function(key) {
var value = Math.round(data[key][0]*100) / 100;
values.push({
x: value,
y: data[key][1],
class: data[key][2],
size: 0.05,
shape: 'diamond'
});
});

return [
{
key: label,
values: values,
color: "#4572A7"
}
];
}
});
</script>
</body>
</html>
Loading

0 comments on commit 3afda37

Please sign in to comment.