Changed some thresholds, mainly cooler

This commit is contained in:
Gaël Métais
2015-06-20 15:19:50 +02:00
parent 1225b27510
commit 8a8b871908
+62 -71
View File
@@ -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>",
"isOkThreshold": 0,
"isBadThreshold": 5,
"isAbnormalThreshold": 10,
"isAbnormalThreshold": 50,
"hasOffenders": true,
"offendersTransformFn": function(offenders) {
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>",
"isOkThreshold": 1,
"isBadThreshold": 7,
"isAbnormalThreshold": 12,
"isAbnormalThreshold": 15,
"hasOffenders": true,
"offendersTransformFn": function(offenders) {
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": {
"tool": "phantomas",
"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>",
"isOkThreshold": 0,
"isBadThreshold": 10,
"isAbnormalThreshold": 25,
"isAbnormalThreshold": 50,
"hasOffenders": false
},
"globalVariables": {
@@ -264,8 +255,8 @@ var policies = {
"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>",
"isOkThreshold": 30,
"isBadThreshold": 100,
"isAbnormalThreshold": 400,
"isBadThreshold": 150,
"isAbnormalThreshold": 700,
"hasOffenders": true,
"offendersTransformFn": function(offenders) {
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>",
"isOkThreshold": 0,
"isBadThreshold": 1,
"isAbnormalThreshold": 8,
"isAbnormalThreshold": 20,
"hasOffenders": true,
"offendersTransformFn": function(offenders) {
return {
@@ -901,6 +892,62 @@ var policies = {
"isAbnormalThreshold": 180,
"hasOffenders": true
},
"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])
};
})
};
}
},
"notFound": {
"tool": "phantomas",
"label": "404 not found",
"message": "<p>404 errors are never cached, so each time a page ask for it, it hits the server. Even if it is behind a CDN or a reverse-proxy cache.</p>",
"isOkThreshold": 0,
"isBadThreshold": 1,
"isAbnormalThreshold": 1,
"hasOffenders": true
},
"closedConnections": {
"tool": "phantomas",
"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>",
"isOkThreshold": 0,
"isBadThreshold": 7,
"isAbnormalThreshold": 20,
"hasOffenders": true
},
"multipleRequests": {
"tool": "phantomas",
"label": "Duplicated requests",
"message": "<p>This only happens when the asset has no cache and is requested more than once on the same page. Be very careful about it.</p>",
"isOkThreshold": 0,
"isBadThreshold": 3,
"isAbnormalThreshold": 10,
"hasOffenders": true
},
"smallRequests": {
"tool": "weightChecker",
"label": "Small requests",
@@ -919,33 +966,6 @@ var policies = {
"isAbnormalThreshold": 30,
"hasOffenders": true
},
"notFound": {
"tool": "phantomas",
"label": "404 not found",
"message": "<p>404 errors are never cached, so each time a page ask for it, it hits the server. Even if it is behind a CDN or a reverse-proxy cache.</p>",
"isOkThreshold": 0,
"isBadThreshold": 1,
"isAbnormalThreshold": 1,
"hasOffenders": true
},
"closedConnections": {
"tool": "phantomas",
"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>",
"isOkThreshold": 0,
"isBadThreshold": 8,
"isAbnormalThreshold": 20,
"hasOffenders": true
},
"multipleRequests": {
"tool": "phantomas",
"label": "Duplicated requests",
"message": "<p>This only happens when the asset has no cache and is requested more than once on the same page. Be very careful about it.</p>",
"isOkThreshold": 0,
"isBadThreshold": 3,
"isAbnormalThreshold": 10,
"hasOffenders": true
},
"cachingDisabled": {
"tool": "phantomas",
"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])
};
})
};
}
}
};