Explorar o código

Disabling eval count because it can cause JS errors

Gaël Métais %!s(int64=10) %!d(string=hai) anos
pai
achega
fb4d6afb07

+ 0 - 1
lib/metadata/scoreProfileGeneric.json

@@ -23,7 +23,6 @@
             "label": "Bad JavaScript",
             "policies": {
                 "jsErrors": 2,
-                "evalCalls": 1,
                 "documentWriteCalls": 2,
                 "consoleMessages": 0.5,
                 "globalVariables": 0.5

+ 8 - 8
lib/tools/phantomas/custom_modules/modules/javaScriptBottleYLT/javaScriptBottleYLT.js

@@ -7,11 +7,11 @@
  */
 /* global document: true, window: true */
 
-exports.version = '0.1';
+exports.version = '0.1.a';
 
 exports.module = function(phantomas) {
     'use strict';
-    
+
     phantomas.setMetric('documentWriteCalls'); //@desc number of calls to either document.write or document.writeln
     phantomas.setMetric('evalCalls'); // @desc number of calls to eval (either direct or via setTimeout / setInterval)
 
@@ -25,23 +25,23 @@ exports.module = function(phantomas) {
                 }
 
                 // spy calls to eval()
-                phantomas.spy(window, 'eval', function(code) {
+                /*phantomas.spy(window, 'eval', function(code) {
                     report('eval() called directly', phantomas.getCaller(), phantomas.getBacktrace(), 'evalCalls');
                     phantomas.log('eval\'ed code: ' + (code || '').substring(0, 150) + '(...)');
-                });
+                });*/
 
                 // spy calls to setTimeout / setInterval with string passed instead of a function
-                phantomas.spy(window, 'setTimeout', function(fn, interval) {
+                /*phantomas.spy(window, 'setTimeout', function(fn, interval) {
                     if (typeof fn !== 'string') return;
 
                     report('eval() called via setTimeout("' + fn + '")', phantomas.getCaller(), phantomas.getBacktrace(), 'evalCalls');
-                });
+                });*/
 
-                phantomas.spy(window, 'setInterval', function(fn, interval) {
+                /*phantomas.spy(window, 'setInterval', function(fn, interval) {
                     if (typeof fn !== 'string') return;
 
                     report('eval() called via setInterval("' + fn + '")', phantomas.getCaller(), phantomas.getBacktrace(), 'evalCalls');
-                });
+                });*/
 
                 // spy document.write(ln)
                 phantomas.spy(document, 'write', function(arg) {