Easier to understand css offenders
This commit is contained in:
@@ -390,11 +390,20 @@ var policies = {
|
||||
return {
|
||||
count: offenders.length,
|
||||
list: offenders.map(function(offender) {
|
||||
if (offender === '[inline CSS] (Empty CSS was provided)') {
|
||||
return {
|
||||
error: 'Empty style tag',
|
||||
file: null,
|
||||
line: null,
|
||||
column: null
|
||||
};
|
||||
}
|
||||
|
||||
var parts = /^(?:(?:<([^ \(]*)>|\[inline CSS\]) ?)?(?:\((((?! @ ).)*)(?: @ (\d+):(\d+))?\))?$/.exec(offender);
|
||||
|
||||
if (parts) {
|
||||
return {
|
||||
error: parts[2],
|
||||
error: parts[2] || 'Unknown parsing error',
|
||||
file: parts[1] || null,
|
||||
line: (parts[4] && parts[5]) ? parseInt(parts[4], 10) : null,
|
||||
column: (parts[4] && parts[5]) ? parseInt(parts[5], 10) : null
|
||||
@@ -406,11 +415,11 @@ var policies = {
|
||||
|
||||
if (parts) {
|
||||
return {
|
||||
error: parts[1],
|
||||
error: parts[1] || 'Unknown parsing error',
|
||||
file: parts[2] || null,
|
||||
line: parseInt(parts[3], 10),
|
||||
column: parseInt(parts[4], 10)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user