DOMQueriesAvoidable taking offenders from DOMQueriesDuplicated
This commit is contained in:
@@ -55,7 +55,8 @@ var policies = {
|
||||
"message": "<p>This is the number of queries that could be avoided by removing all duplicated queries.</p><p>Simply save the result of a query in a variable. Ok it is not always simple, especially with third-party scripts, but at least do it with your own code.</p>",
|
||||
"isOkThreshold": 0,
|
||||
"isBadThreshold": 200,
|
||||
"isAbnormalThreshold": 500
|
||||
"isAbnormalThreshold": 500,
|
||||
"takeOffendersFrom": "DOMqueriesDuplicated"
|
||||
},
|
||||
"eventsBound": {
|
||||
"tool": "phantomas",
|
||||
|
||||
@@ -23,6 +23,11 @@ var RulesChecker = function() {
|
||||
policy: policy
|
||||
};
|
||||
|
||||
// Take DOMqueriesAvoidable's offenders from DOMqueriesDuplicated.
|
||||
if (policy.takeOffendersFrom) {
|
||||
data.toolsResults[policy.tool].offenders[metricName] = data.toolsResults[policy.tool].offenders[policy.takeOffendersFrom];
|
||||
}
|
||||
|
||||
if (data.toolsResults[policy.tool].offenders &&
|
||||
data.toolsResults[policy.tool].offenders[metricName] &&
|
||||
data.toolsResults[policy.tool].offenders[metricName].length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user