Small adjustments in notations

This commit is contained in:
Gaël Métais
2014-09-18 16:43:11 +02:00
parent e3c2f0272f
commit aeb1da74fe
2 changed files with 11 additions and 7 deletions
+6 -3
View File
@@ -93,7 +93,7 @@
</div>
</div>
<div>
<div ng-class="notations.badPractices">{{notations.badPractices}}</div>
<div ng-class="notations.jsBadPractices">{{notations.jsBadPractices}}</div>
<div class="notation">Bad Javascript</div>
<div class="criteria">
<ul>
@@ -109,12 +109,15 @@
<li ng-if="phantomasResults.metrics.consoleMessages">
Console messages: {{phantomasResults.metrics.consoleMessages}}
</li>
<li ng-if="phantomasResults.metrics.globalVariables">
Global variables: {{phantomasResults.metrics.globalVariables}}
</li>
</ul>
</div>
</div>
<div>
<div ng-class="notations.scripts">{{notations.scripts}}</div>
<div class="notation">Scripts loaded</div>
<div class="notation">JS files loaded</div>
<div class="criteria">
<ul>
<li ng-if="phantomasResults.metrics.jsCount">
@@ -186,7 +189,7 @@
</div>
<div>
<div ng-class="notations.cssCount">{{notations.cssCount}}</div>
<div class="notation">CSS loaded</div>
<div class="notation">CSS files loaded</div>
<div class="criteria">
<ul>
<li ng-if="phantomasResults.metrics.cssCount">
+5 -4
View File
@@ -71,7 +71,7 @@ app.controller('ResultsCtrl', function ($scope) {
domManipulations: getDomManipulationsScore(),
duplicatedDomQueries: getDuplicatedDomQueriesScore(),
eventsBound: getEventsBoundScore(),
badPractices: getBadPracticesScore(),
jsBadPractices: getJSBadPracticesScore(),
scripts: getScriptsScore(),
jQueryLoading: getJQueryLoadingScore(),
cssComplexity: getCSSComplexityScore(),
@@ -241,12 +241,13 @@ app.controller('ResultsCtrl', function ($scope) {
return note;
}
function getBadPracticesScore() {
function getJSBadPracticesScore() {
var note = 'A';
var score = $scope.phantomasResults.metrics.documentWriteCalls * 3 +
$scope.phantomasResults.metrics.evalCalls * 3 +
$scope.phantomasResults.metrics.evalCalls * 2 +
$scope.phantomasResults.metrics.jsErrors * 10 +
$scope.phantomasResults.metrics.consoleMessages;
$scope.phantomasResults.metrics.consoleMessages / 2 +
$scope.phantomasResults.metrics.globalVariables / 10;
if (score > 5) {
note = 'B';
}