Skip to content
This repository was archived by the owner on Sep 15, 2021. It is now read-only.

Commit 1521d22

Browse files
committed
Merge branch '164-use-strict' of https://github.com/zombie/scanjs into zombie-164-use-strict
2 parents 3197aca + e5ddc32 commit 1521d22

File tree

8 files changed

+31
-16
lines changed

8 files changed

+31
-16
lines changed

client/js/experimentctrl.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
scanjsModule.controller('ExperimentCtrl', ['$scope', 'ScanSvc', function ExperimentCtrl($scope, ScanSvc) {
24
if (!document.getElementById("experiment-mirror").children.length) {
35
$scope.codeMirror = new CodeMirror(document.getElementById('experiment-mirror'), {

client/js/locationctrl.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
scanjsModule.controller('LocationCtrl', ['$scope', '$location', function LocationCtrl($scope, $location) {
24
$scope.tabBtnClass = function (page) {
35
var current = $location.path().substring(1) || 'scan';

client/js/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
var scanjsModule = angular.module('scanjs', ['ui.bootstrap', 'ngRoute']);
24

35
scanjsModule.config(['$routeProvider',

client/js/rulesctrl.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
scanjsModule.controller('RuleListCtrl', ['$scope', 'ScanSvc', function RuleListCtrl($scope, ScanSvc) {
24
$scope.rulesFile = "../common/rules.json";
35
$scope.rules = []; //JSON rules object

client/js/scanctrl.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
scanjsModule.controller('ScanCtrl', ['$scope', 'ScanSvc', function ScanCtrl($scope, ScanSvc) {
24
if (!document.getElementById("codeMirrorDiv").children.length) {
35
$scope.codeMirror = new CodeMirror(document.getElementById('codeMirrorDiv'), {
@@ -35,7 +37,7 @@ scanjsModule.controller('ScanCtrl', ['$scope', 'ScanSvc', function ScanCtrl($sco
3537
$scope.inputFiles.forEach(function (scriptFile, i) {
3638
if (document.getElementById('doScan_'+i).checked) {
3739
pending++;
38-
$scope.throbOutput = true;
40+
$scope.throbOutput = true;
3941
ScanSvc.newScan(scriptFile.name,scriptFile.asText());
4042
}
4143
});
@@ -62,19 +64,19 @@ scanjsModule.controller('ScanCtrl', ['$scope', 'ScanSvc', function ScanCtrl($sco
6264
}, []);
6365
}
6466

65-
$scope.filterResults=function(issue){
66-
if(!issue){
67+
$scope.filterResults=function(issue) {
68+
if (!issue) {
6769
$scope.filteredResults=$scope.results;
6870
}
69-
else{
70-
if(typeof issue.name != "undefined") {
71-
$scope.filteredResults=$scope.results.filter(function(result){
72-
return result.filename === issue.name;
73-
});
74-
}else {
75-
$scope.filteredResults=$scope.results.filter(function(result){
76-
return result.rule.name == issue;
77-
});
71+
else {
72+
if (typeof issue.name != "undefined") {
73+
$scope.filteredResults = $scope.results.filter(function(result) {
74+
return result.filename === issue.name;
75+
});
76+
} else {
77+
$scope.filteredResults = $scope.results.filter(function(result) {
78+
return result.rule.name == issue;
79+
});
7880
}
7981
}
8082
}

client/js/scanservice.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
scanjsModule.factory('ScanSvc', ['$rootScope', '$http', function($rootScope, $http) {
24
var ScanService = {
35
//results:[],

client/js/scanworker.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
/* this makes sure that console.log can be used, even if it is undefined.
24
We won't see the message though, since this kind of postMessage isn't handled in scanservice.js */
35
if (typeof console === "undefined") {

common/scan.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// Plain browser env
1818
mod(this.ScanJS || (this.ScanJS = {}), this.acorn.walk);
1919
})(function (exports, walk) {
20+
"use strict";
2021

2122
// Default parser, override this object to change*
2223
// needs parser.parse to produce an AST
@@ -328,7 +329,7 @@
328329

329330
var nodeTests = {};
330331
//each node type may have multiple tests, so first create arrays of test funcs
331-
for (i in rulesData) {
332+
for (var i in rulesData) {
332333
var rule = rulesData[i];
333334
//parse rule source
334335
var template;
@@ -364,7 +365,7 @@
364365

365366
rules = {};
366367
//create a single function for each nodeType, which calls all the test functions
367-
for (nodeType in nodeTests) {
368+
for (var nodeType in nodeTests) {
368369
rules[nodeType] = function (tests, node) {
369370
tests.forEach(function (test) {
370371
test.call(this, node);
@@ -401,8 +402,8 @@
401402
aw_found_callback = found_callback;
402403
}
403404

404-
function aw_setParser(parserName){
405-
parser = parserName ;
405+
function aw_setParser(newParser){
406+
parser = newParser;
406407
}
407408

408409
exports.rules = rules;

0 commit comments

Comments
 (0)