From 6fe61a041eb94bad8dd073aa772012a28e2d33ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Mon, 29 Dec 2014 10:26:08 +0100 Subject: [PATCH] Add DOMqueriesWithoutResults as a rule --- lib/metadata/policies.js | 8 ++++++++ lib/metadata/scoreProfileGeneric.json | 1 + 2 files changed, 9 insertions(+) diff --git a/lib/metadata/policies.js b/lib/metadata/policies.js index b9cb910..c01566d 100644 --- a/lib/metadata/policies.js +++ b/lib/metadata/policies.js @@ -58,6 +58,14 @@ var policies = { "isAbnormalThreshold": 500, "takeOffendersFrom": "DOMqueriesDuplicated" }, + "DOMqueriesWithoutResults": { + "tool": "phantomas", + "label": "DOM queries without result", + "message": "

Number of queries that return no result.

It suggests the query is not used on the page, probably because it is some dead code.

Or maybe the code is trying to find an HTML block that is not always here. Look at the JS Timeline to see if the scripts correctly figures out the HTML block is not here and immediatly stops interacting further with the DOM.

", + "isOkThreshold": 0, + "isBadThreshold": 100, + "isAbnormalThreshold": 200 + }, "eventsBound": { "tool": "phantomas", "label": "Events bound", diff --git a/lib/metadata/scoreProfileGeneric.json b/lib/metadata/scoreProfileGeneric.json index 8feb3ff..d104e51 100644 --- a/lib/metadata/scoreProfileGeneric.json +++ b/lib/metadata/scoreProfileGeneric.json @@ -14,6 +14,7 @@ "policies": { "DOMinserts": 2, "DOMqueries": 1, + "DOMqueriesWithoutResults": 2, "DOMqueriesAvoidable": 2, "eventsBound": 1 }