Browse Source

Changed some thresholds, mainly cooler

Gaël Métais 10 years ago
parent
commit
8a8b871908
1 changed files with 52 additions and 61 deletions
  1. 52 61
      lib/metadata/policies.js

+ 52 - 61
lib/metadata/policies.js

@@ -43,7 +43,7 @@ var policies = {
         "message": "<p>IDs of HTML elements must be document-wide unique. This can cause problems with getElementById returning the wrong element.</p>",
         "message": "<p>IDs of HTML elements must be document-wide unique. This can cause problems with getElementById returning the wrong element.</p>",
         "isOkThreshold": 0,
         "isOkThreshold": 0,
         "isBadThreshold": 5,
         "isBadThreshold": 5,
-        "isAbnormalThreshold": 10,
+        "isAbnormalThreshold": 50,
         "hasOffenders": true,
         "hasOffenders": true,
         "offendersTransformFn": function(offenders) {
         "offendersTransformFn": function(offenders) {
             return {
             return {
@@ -122,7 +122,7 @@ var policies = {
         "message": "<p>Number of 'scroll' event listeners binded to 'window' or 'document'.</p><p>Asking too much work to the browser on scroll hurts the smoothness of the scroll. Merging all your event listeners into an unique listener can help you factorize their code and reduce their footprint on scroll.</p>",
         "message": "<p>Number of 'scroll' event listeners binded to 'window' or 'document'.</p><p>Asking too much work to the browser on scroll hurts the smoothness of the scroll. Merging all your event listeners into an unique listener can help you factorize their code and reduce their footprint on scroll.</p>",
         "isOkThreshold": 1,
         "isOkThreshold": 1,
         "isBadThreshold": 7,
         "isBadThreshold": 7,
-        "isAbnormalThreshold": 12,
+        "isAbnormalThreshold": 15,
         "hasOffenders": true,
         "hasOffenders": true,
         "offendersTransformFn": function(offenders) {
         "offendersTransformFn": function(offenders) {
             return {
             return {
@@ -190,15 +190,6 @@ var policies = {
             };
             };
         }
         }
     },
     },
-    /*"evalCalls": {
-        "tool": "phantomas",
-        "label": "eval calls",
-        "message": "<p>The 'eval' function is slow and is a bad coding practice. Try to get rid of it.</p>",
-        "isOkThreshold": 0,
-        "isBadThreshold": 10,
-        "isAbnormalThreshold": 20,
-        "hasOffenders": false
-    },*/
     "documentWriteCalls": {
     "documentWriteCalls": {
         "tool": "phantomas",
         "tool": "phantomas",
         "label": "document.write calls",
         "label": "document.write calls",
@@ -256,7 +247,7 @@ var policies = {
         "message": "<p>Try to keep your console clean when in production. Debugging is good for development only.</p><p>Writing in the console has a cost, especially when dumping large object variables.</p><p>There is also a problem with Internet Explorer 8, not knowing the console object.</p>",
         "message": "<p>Try to keep your console clean when in production. Debugging is good for development only.</p><p>Writing in the console has a cost, especially when dumping large object variables.</p><p>There is also a problem with Internet Explorer 8, not knowing the console object.</p>",
         "isOkThreshold": 0,
         "isOkThreshold": 0,
         "isBadThreshold": 10,
         "isBadThreshold": 10,
-        "isAbnormalThreshold": 25,
+        "isAbnormalThreshold": 50,
         "hasOffenders": false
         "hasOffenders": false
     },
     },
     "globalVariables": {
     "globalVariables": {
@@ -264,8 +255,8 @@ var policies = {
         "label": "Global variables",
         "label": "Global variables",
         "message": "<p>It is a bad practice because they clutter up the global namespace. If two scripts use the same variable name in the global scope, it can cause conflicts and it is generally hard to debug.</p><p>Global variables also take a (very) little bit longer to be accessed than variables in the local scope of a function.</p>",
         "message": "<p>It is a bad practice because they clutter up the global namespace. If two scripts use the same variable name in the global scope, it can cause conflicts and it is generally hard to debug.</p><p>Global variables also take a (very) little bit longer to be accessed than variables in the local scope of a function.</p>",
         "isOkThreshold": 30,
         "isOkThreshold": 30,
-        "isBadThreshold": 100,
-        "isAbnormalThreshold": 400,
+        "isBadThreshold": 150,
+        "isAbnormalThreshold": 700,
         "hasOffenders": true,
         "hasOffenders": true,
         "offendersTransformFn": function(offenders) {
         "offendersTransformFn": function(offenders) {
             return {
             return {
@@ -375,7 +366,7 @@ var policies = {
         "message": "<p>Yellow Lab Tools failed to parse a CSS file. I doubt the problem comes from the css parser.</p><p>Maybe a <a href=\"http://jigsaw.w3.org/css-validator\" target=\"_blank\">CSS validator</a> can help you.</p>",
         "message": "<p>Yellow Lab Tools failed to parse a CSS file. I doubt the problem comes from the css parser.</p><p>Maybe a <a href=\"http://jigsaw.w3.org/css-validator\" target=\"_blank\">CSS validator</a> can help you.</p>",
         "isOkThreshold": 0,
         "isOkThreshold": 0,
         "isBadThreshold": 1,
         "isBadThreshold": 1,
-        "isAbnormalThreshold": 8,
+        "isAbnormalThreshold": 20,
         "hasOffenders": true,
         "hasOffenders": true,
         "offendersTransformFn": function(offenders) {
         "offendersTransformFn": function(offenders) {
             return {
             return {
@@ -901,23 +892,34 @@ var policies = {
         "isAbnormalThreshold": 180,
         "isAbnormalThreshold": 180,
         "hasOffenders": true
         "hasOffenders": true
     },
     },
-    "smallRequests": {
-        "tool": "weightChecker",
-        "label": "Small requests",
-        "message": "<p>List of all requests that are less than 2 KB. Try to merge them with other files.</p>",
-        "isOkThreshold": 4,
-        "isBadThreshold": 30,
-        "isAbnormalThreshold": 50,
-        "hasOffenders": true
-    },
-    "lazyLoadableImagesBelowTheFold": {
+    "domains": {
         "tool": "phantomas",
         "tool": "phantomas",
-        "label": "Not lazyloaded images",
-        "message": "<p>This is the number of images displayed below the fold that could be lazy-loaded. This is an excellent way to accelerate the loading time of an heavy page.</p><p>I recommend using <a href=\"https://github.com/vvo/lazyload\" target=\"_blank\">this lazyloader</a>.</p>",
-        "isOkThreshold": 1,
-        "isBadThreshold": 12,
-        "isAbnormalThreshold": 30,
-        "hasOffenders": true
+        "label": "Different domains",
+        "message": "<p>For each domain met, the browser needs to make a DNS look-up, which is slow. Avoid having to many different domains and the page should render faster.</p><p>By the way, domain sharding is not a good practice anymore.</p>",
+        "isOkThreshold": 10,
+        "isBadThreshold": 25,
+        "isAbnormalThreshold": 50,
+        "hasOffenders": true,
+        "offendersTransformFn": function(offenders) {
+            return {
+                count: offenders.length,
+                list: offenders.map(function(offender) {
+                    var parts = /^([^ ]*): (\d+) request\(s\)$/.exec(offender);
+
+                    if (!parts) {
+                        debug('domains offenders transform function error with "%s"', offender);
+                        return {
+                            file: offender
+                        };
+                    }
+
+                    return {
+                        domain: parts[1],
+                        requests: parseInt(parts[2])
+                    };
+                })
+            };
+        }
     },
     },
     "notFound": {
     "notFound": {
         "tool": "phantomas",
         "tool": "phantomas",
@@ -933,7 +935,7 @@ var policies = {
         "label": "Connections closed",
         "label": "Connections closed",
         "message": "<p>This counts the number of requests not keeping the connection alive (specifying \"Connection: close\" in the response headers). It is only counting a request if it is followed by another request on the same domain.</p><p>This is slowing down the next request, because the brower needs to open a new connection to the server, which means an additional round-trip.</p><p>Correct the problem by setting a Keep-Alive header on the guilty server.</p>",
         "message": "<p>This counts the number of requests not keeping the connection alive (specifying \"Connection: close\" in the response headers). It is only counting a request if it is followed by another request on the same domain.</p><p>This is slowing down the next request, because the brower needs to open a new connection to the server, which means an additional round-trip.</p><p>Correct the problem by setting a Keep-Alive header on the guilty server.</p>",
         "isOkThreshold": 0,
         "isOkThreshold": 0,
-        "isBadThreshold": 8,
+        "isBadThreshold": 7,
         "isAbnormalThreshold": 20,
         "isAbnormalThreshold": 20,
         "hasOffenders": true
         "hasOffenders": true
     },
     },
@@ -946,6 +948,24 @@ var policies = {
         "isAbnormalThreshold": 10,
         "isAbnormalThreshold": 10,
         "hasOffenders": true
         "hasOffenders": true
     },
     },
+    "smallRequests": {
+        "tool": "weightChecker",
+        "label": "Small requests",
+        "message": "<p>List of all requests that are less than 2 KB. Try to merge them with other files.</p>",
+        "isOkThreshold": 4,
+        "isBadThreshold": 30,
+        "isAbnormalThreshold": 50,
+        "hasOffenders": true
+    },
+    "lazyLoadableImagesBelowTheFold": {
+        "tool": "phantomas",
+        "label": "Not lazyloaded images",
+        "message": "<p>This is the number of images displayed below the fold that could be lazy-loaded. This is an excellent way to accelerate the loading time of an heavy page.</p><p>I recommend using <a href=\"https://github.com/vvo/lazyload\" target=\"_blank\">this lazyloader</a>.</p>",
+        "isOkThreshold": 1,
+        "isBadThreshold": 12,
+        "isAbnormalThreshold": 30,
+        "hasOffenders": true
+    },
     "cachingDisabled": {
     "cachingDisabled": {
         "tool": "phantomas",
         "tool": "phantomas",
         "label": "Caching disabled",
         "label": "Caching disabled",
@@ -1022,35 +1042,6 @@ var policies = {
                     })
                     })
             };
             };
         }
         }
-    },
-    "domains": {
-        "tool": "phantomas",
-        "label": "Different domains",
-        "message": "<p>For each domain met, the browser needs to make a DNS look-up, which is slow. Avoid having to many different domains and the page should render faster.</p><p>By the way, domain sharding is not a good practice anymore.</p>",
-        "isOkThreshold": 10,
-        "isBadThreshold": 25,
-        "isAbnormalThreshold": 50,
-        "hasOffenders": true,
-        "offendersTransformFn": function(offenders) {
-            return {
-                count: offenders.length,
-                list: offenders.map(function(offender) {
-                    var parts = /^([^ ]*): (\d+) request\(s\)$/.exec(offender);
-
-                    if (!parts) {
-                        debug('domains offenders transform function error with "%s"', offender);
-                        return {
-                            file: offender
-                        };
-                    }
-
-                    return {
-                        domain: parts[1],
-                        requests: parseInt(parts[2])
-                    };
-                })
-            };
-        }
     }
     }
 };
 };