Skip to content

Commit

Permalink
Bumping up typhonjs-escomplex to 0.1.0
Browse files Browse the repository at this point in the history
### REASON
solve several es6 issues (es-analysis#214)
  • Loading branch information
kyungilpark committed Jun 27, 2019
1 parent daa083c commit 5baa923
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions lib/assets/scripts/plato-overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ $(function(){
reports.forEach(function(report){

// @todo shouldn't need this, 'auto [num]' doesn't seem to work : https://github.com/oesmith/morris.js/issues/201
sloc.ymax = Math.max(sloc.ymax, report.complexity.methodAggregate.sloc.physical);
bugs.ymax = Math.max(bugs.ymax, report.complexity.methodAggregate.halstead.bugs.toFixed(2));
sloc.ymax = Math.max(sloc.ymax, report.complexity.aggregate.sloc.physical);
bugs.ymax = Math.max(bugs.ymax, report.complexity.aggregate.halstead.bugs.toFixed(2));


sloc.data.push({
value : report.complexity.methodAggregate.sloc.physical,
value : report.complexity.aggregate.sloc.physical,
label : report.info.fileShort
});
bugs.data.push({
value : report.complexity.methodAggregate.halstead.bugs.toFixed(2),
value : report.complexity.aggregate.halstead.bugs.toFixed(2),
label : report.info.fileShort
});
maintainability.data.push({
Expand Down
8 changes: 4 additions & 4 deletions lib/models/FileHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ FileHistory.prototype.addReport = function(report, date) {
date = date || report.date || new Date().toUTCString();
this.push({
date : date,
sloc : report.complexity.methodAggregate.sloc.physical,
lloc : report.complexity.methodAggregate.sloc.logical,
sloc : report.complexity.aggregate.sloc.physical,
lloc : report.complexity.aggregate.sloc.logical,
functions : report.complexity.methods.length,
deliveredBugs : report.complexity.methodAggregate.halstead.bugs,
difficulty: report.complexity.methodAggregate.halstead.difficulty,
deliveredBugs : report.complexity.aggregate.halstead.bugs,
difficulty: report.complexity.aggregate.halstead.difficulty,
maintainability: report.complexity.maintainability,
lintErrors : (report.jshint && report.jshint.messages.length) || []
});
Expand Down
6 changes: 3 additions & 3 deletions lib/plato.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ exports.getOverviewReport = function (reports) {

reports.forEach(function(report) {
// clone objects so we don't have to worry about side effects
summary.total.sloc += report.complexity.methodAggregate.sloc.physical;
summary.total.sloc += report.complexity.aggregate.sloc.physical;
summary.total.maintainability += report.complexity.maintainability;

var methodAggregate = _.cloneDeep(report.complexity.methodAggregate);
var aggregate = _.cloneDeep(report.complexity.aggregate);
var reportItem = {};
reportItem.info = report.info;
if (report.jshint) {
Expand All @@ -209,7 +209,7 @@ exports.getOverviewReport = function (reports) {
}
if (report.complexity) {
reportItem.complexity = {
methodAggregate : methodAggregate,
aggregate : aggregate,
module : report.complexity.module,
module_safe : report.complexity.module_safe,
maintainability : _.cloneDeep(report.complexity.maintainability)
Expand Down
4 changes: 2 additions & 2 deletions lib/templates/display.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ <h2 class="reportTitle">Worst Maintainability Scores</h2>
<div class="reportBlock locList">
<h2 class="reportTitle">Largest Files</h2>
<ul class="list-unstyled">
<% _.each(_.take(_.sortBy(report.reports, function (report) { return -1 * report.complexity.methodAggregate.sloc.physical }), 5), function(report, i) { %>
<% _.each(_.take(_.sortBy(report.reports, function (report) { return -1 * report.complexity.aggregate.sloc.physical }), 5), function(report, i) { %>
<li>
<strong><%= report.complexity.methodAggregate.sloc.physical %> lines</strong>
<strong><%= report.complexity.aggregate.sloc.physical %> lines</strong>
<small><%= report.info.fileShort %></small>
</li>
<% }); %>
Expand Down
6 changes: 3 additions & 3 deletions lib/templates/file.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ <h2 class="header">Maintainability <a href="http://blogs.msdn.com/b/codeanalysis
</div>
<div class="col-md-6">
<h2 class="header">Lines of code <i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="Source Lines of Code / Logical Lines of Code" data-original-title="SLOC/LSLOC" data-container="body"></i></h2>
<p class="stat"><%= report.complexity.methodAggregate.sloc.physical %></p>
<p class="stat"><%= report.complexity.aggregate.sloc.physical %></p>
</div>
</div>
<div class="row historical">
Expand All @@ -62,11 +62,11 @@ <h2 class="header">Lines of code <i class="icon icon-info-sign" rel="popover" da
<div class="row">
<div class="col-md-6">
<h2 class="header">Difficulty <a href="http://en.wikipedia.org/wiki/Halstead_complexity_measures"><i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="The difficulty measure is related to the difficulty of the program to write or understand." data-original-title="Difficulty" data-container="body"></i></a></h2>
<p class="stat"><%= report.complexity.methodAggregate.halstead.difficulty.toFixed(2) %></p>
<p class="stat"><%= report.complexity.aggregate.halstead.difficulty.toFixed(2) %></p>
</div>
<div class="col-md-6">
<h2 class="header">Estimated Errors <a href="http://en.wikipedia.org/wiki/Halstead_complexity_measures"><i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="Halstead's delivered bugs is an estimate for the number of errors in the implementation." data-original-title="Delivered Bugs" data-container="body"></i></a></h2>
<p class="stat"><%= report.complexity.methodAggregate.halstead.bugs.toFixed(2) %></p>
<p class="stat"><%= report.complexity.aggregate.halstead.bugs.toFixed(2) %></p>
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions lib/templates/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ <h1 class="col-md-12">Files</h1>
<span class="col-md-4 file"><a class="file-link" href="./<%= item.info.link %>"><%= item.info.fileShort %></a></span>
<span class="col-md-8 file-chart js-file-chart"
data-lint="<%= item.jshint && item.jshint.messages %>"
data-sloc="<%= item.complexity.methodAggregate.sloc.physical %>"
data-bugs="<%= item.complexity.methodAggregate.halstead.bugs.toFixed(2) %>"
data-complexity="<%= item.complexity.methodAggregate.cyclomatic%>"
data-sloc="<%= item.complexity.aggregate.sloc.physical %>"
data-bugs="<%= item.complexity.aggregate.halstead.bugs.toFixed(2) %>"
data-complexity="<%= item.complexity.aggregate.cyclomatic%>"
></span>
</div>
</li>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@
"jshint": "~2.9.2",
"lodash": "^4.17.11",
"posix-getopt": "~1.2.0",
"typhonjs-escomplex": "0.0.9"
"typhonjs-escomplex": "0.1.0"
}
}
2 changes: 1 addition & 1 deletion test/fixtures/model_history.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"complexity":{
"lineStart":1,
"methodAggregate":{
"aggregate":{
"sloc":{
"physical":22,
"logical":10
Expand Down
8 changes: 4 additions & 4 deletions test/model_filehistory_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ exports['FileHistory'] = {
var newReport = require('./fixtures/model_history.json');
history.addReport(newReport);

test.equal(history[0].sloc, newReport.complexity.methodAggregate.sloc.physical);
test.equal(history[0].lloc, newReport.complexity.methodAggregate.sloc.logical);
test.equal(history[0].deliveredBugs, newReport.complexity.methodAggregate.halstead.bugs);
test.equal(history[0].difficulty, newReport.complexity.methodAggregate.halstead.difficulty);
test.equal(history[0].sloc, newReport.complexity.aggregate.sloc.physical);
test.equal(history[0].lloc, newReport.complexity.aggregate.sloc.logical);
test.equal(history[0].deliveredBugs, newReport.complexity.aggregate.halstead.bugs);
test.equal(history[0].difficulty, newReport.complexity.aggregate.halstead.difficulty);
test.equal(history[0].maintainability, newReport.complexity.maintainability);
test.equal(history[0].functions, newReport.complexity.methods.length);
test.equal(history[0].lintErrors, newReport.jshint.messages.length);
Expand Down

0 comments on commit 5baa923

Please sign in to comment.