Add file names to duplicated css selectors offenders (#233)

This commit is contained in:
Gaël Métais
2017-05-27 18:18:09 +01:00
committed by GitHub
parent ce16fa154c
commit df4a45afb2
3 changed files with 20 additions and 20 deletions
+15 -15
View File
@@ -596,24 +596,24 @@ var policies = {
"isAbnormalThreshold": 100,
"hasOffenders": true,
"offendersTransformFn": function(offenders) {
return {
count: offenders.length,
list: offenders.map(function(offender) {
var parts = /^(.*) \((\d+) times\)$/.exec(offender);
if (!parts) {
debug('cssDuplicatedSelectors offenders transform function error with "%s"', offender);
return {
parseError: offender
};
}
var parsedOffenders = offenders.map(function(offender) {
var parts = /^(.*) \((\d+) times\) ?<(.*)>$/.exec(offender);
if (!parts) {
debug('cssDuplicatedSelectors offenders transform function error with "%s"', offender);
return {
rule: parts[1],
occurrences: parseInt(parts[2], 10)
parseError: offender
};
})
};
}
return {
rule: parts[1],
occurrences: parseInt(parts[2], 10),
file: parts[3]
};
});
return offendersHelpers.orderByFile(parsedOffenders);
}
},
"cssDuplicatedProperties": {