|
@@ -44,27 +44,7 @@ var policies = {
|
|
"isOkThreshold": 0,
|
|
"isOkThreshold": 0,
|
|
"isBadThreshold": 5,
|
|
"isBadThreshold": 5,
|
|
"isAbnormalThreshold": 50,
|
|
"isAbnormalThreshold": 50,
|
|
- "hasOffenders": true,
|
|
|
|
- "offendersTransformFn": function(offenders) {
|
|
|
|
- return {
|
|
|
|
- count: offenders.length,
|
|
|
|
- list: offenders.map(function(offender) {
|
|
|
|
- var parts = /^(.*): ?(\d+) ?occurrences$/.exec(offender);
|
|
|
|
-
|
|
|
|
- if (!parts) {
|
|
|
|
- debug('DOMidDuplicated offenders transform function error with "%s"', offender);
|
|
|
|
- return {
|
|
|
|
- parseError: offender
|
|
|
|
- };
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return {
|
|
|
|
- id: parts[1],
|
|
|
|
- occurrences: parseInt(parts[2], 10)
|
|
|
|
- };
|
|
|
|
- })
|
|
|
|
- };
|
|
|
|
- }
|
|
|
|
|
|
+ "hasOffenders": true
|
|
},
|
|
},
|
|
"DOMqueriesAvoidable": {
|
|
"DOMqueriesAvoidable": {
|
|
"tool": "phantomas",
|
|
"tool": "phantomas",
|
|
@@ -330,7 +310,7 @@ var policies = {
|
|
return {
|
|
return {
|
|
count: offenders.length,
|
|
count: offenders.length,
|
|
list: offenders.map(function(offender) {
|
|
list: offenders.map(function(offender) {
|
|
- if (offender === '[inline CSS] (Empty CSS was provided)') {
|
|
|
|
|
|
+ if (offender === '[inline CSS]') {
|
|
return {
|
|
return {
|
|
error: 'Empty style tag',
|
|
error: 'Empty style tag',
|
|
file: null,
|
|
file: null,
|
|
@@ -339,30 +319,15 @@ var policies = {
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
- var parts = /^(?:(?:<([^ \(]*)>|\[inline CSS\]) ?)?(?:\((((?! @ ).)*)(?: @ (\d+):(\d+))?\))?$/.exec(offender);
|
|
|
|
-
|
|
|
|
- if (parts) {
|
|
|
|
- return {
|
|
|
|
- error: parts[2] || 'Unknown parsing error' + (parts[1] ? '. The entire file was ignored. As a result, the other CSS metrics and scores are miscalculated.' : ''),
|
|
|
|
- file: parts[1] || null,
|
|
|
|
- line: (parts[4] && parts[5]) ? parseInt(parts[4], 10) : null,
|
|
|
|
- column: (parts[4] && parts[5]) ? parseInt(parts[5], 10) : null
|
|
|
|
- };
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // Try another syntax
|
|
|
|
- parts = /^(.*) <(.*)> @ (\d+):(\d+)$/.exec(offender);
|
|
|
|
-
|
|
|
|
- if (parts) {
|
|
|
|
|
|
+ if (offender.value) {
|
|
return {
|
|
return {
|
|
- error: parts[1] || 'Unknown parsing error',
|
|
|
|
- file: parts[2] || null,
|
|
|
|
- line: parseInt(parts[3], 10),
|
|
|
|
- column: parseInt(parts[4], 10)
|
|
|
|
|
|
+ error: offender.value.message || 'Unknown parsing error' + (parts[1] ? '. The entire file was ignored. As a result, the other CSS metrics and scores are miscalculated.' : ''),
|
|
|
|
+ file: offender.file || null,
|
|
|
|
+ line: offender.value.position ? offender.value.position.start.line : null,
|
|
|
|
+ column: offender.value.position ? offender.value.position.start.column : null
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
debug('cssParsingErrors offenders transform function error with "%s"', offender);
|
|
debug('cssParsingErrors offenders transform function error with "%s"', offender);
|
|
return {
|
|
return {
|
|
parseError: offender
|
|
parseError: offender
|
|
@@ -971,7 +936,7 @@ var policies = {
|
|
return offenders;
|
|
return offenders;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- "unusedUnicodeRanges": {
|
|
|
|
|
|
+ /*"unusedUnicodeRanges": {
|
|
"tool": "redownload",
|
|
"tool": "redownload",
|
|
"label": "Unused Unicode ranges",
|
|
"label": "Unused Unicode ranges",
|
|
"message": "<p>This metric counts the number of unused Unicode ranges inside each font. For example, one font could include Cyrillic glyphs but none of them are used on the page.</p><p>It also reveals the number of ligatures (letters that are represented differently when close to each other) and hidden chars (glyphs not linked to the unicode system that can't be displayed on the web).</p><p>Because of technical limitations, Yellow Lab Tools checks each font against the glyphs of the entire page. As a result, estimated use is >= to reality. For example, if you read that 10 glyphs are \"possibly used\", it means that these 10 glyphs are used on the page but nothing guaranties that they are displayed using this font.</p><p>Tools such as <a href=\"https://www.fontsquirrel.com/tools/webfont-generator\" target=\"_blank\">Font Squirrel</a> can remove some unicode ranges from a font.</p><p>In the case of an icon font, make sure you only keep the icons that are used on the website and to remove the others. Several tools are able to extract SVG images from a font, then some other tools can generate a font from the SVGs you want to keep.</p>",
|
|
"message": "<p>This metric counts the number of unused Unicode ranges inside each font. For example, one font could include Cyrillic glyphs but none of them are used on the page.</p><p>It also reveals the number of ligatures (letters that are represented differently when close to each other) and hidden chars (glyphs not linked to the unicode system that can't be displayed on the web).</p><p>Because of technical limitations, Yellow Lab Tools checks each font against the glyphs of the entire page. As a result, estimated use is >= to reality. For example, if you read that 10 glyphs are \"possibly used\", it means that these 10 glyphs are used on the page but nothing guaranties that they are displayed using this font.</p><p>Tools such as <a href=\"https://www.fontsquirrel.com/tools/webfont-generator\" target=\"_blank\">Font Squirrel</a> can remove some unicode ranges from a font.</p><p>In the case of an icon font, make sure you only keep the icons that are used on the website and to remove the others. Several tools are able to extract SVG images from a font, then some other tools can generate a font from the SVGs you want to keep.</p>",
|
|
@@ -982,7 +947,7 @@ var policies = {
|
|
"offendersTransformFn": function(offenders) {
|
|
"offendersTransformFn": function(offenders) {
|
|
return offenders;
|
|
return offenders;
|
|
}
|
|
}
|
|
- },
|
|
|
|
|
|
+ },*/
|
|
"http2": {
|
|
"http2": {
|
|
"label": "HTTP/2 or SPDY",
|
|
"label": "HTTP/2 or SPDY",
|
|
"message": "<p>HTTP/2 is the latest version of the HTTP protocol and is designed to optimize load speed. SPDY is deprecated but still very well supported.</p><p>The latest versions of all major browsers are now compatible. The difficulty is on the server side, where technologies are not quite ready yet.</p>",
|
|
"message": "<p>HTTP/2 is the latest version of the HTTP protocol and is designed to optimize load speed. SPDY is deprecated but still very well supported.</p><p>The latest versions of all major browsers are now compatible. The difficulty is on the server side, where technologies are not quite ready yet.</p>",
|