Add file names to duplicated css selectors offenders (#233)
This commit is contained in:
+15
-15
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user