From a1278fad49f5b7878364be6f9341f8b7e7ccb30e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Thu, 20 Nov 2014 11:10:10 +0100 Subject: [PATCH 1/5] #2 Better CSS parsing error message --- app/node_views/results.html | 42 ++++++++++++++++++++----------- app/public/scripts/resultsCtrl.js | 17 ++++++++++--- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/app/node_views/results.html b/app/node_views/results.html index 6d2c686..e017095 100644 --- a/app/node_views/results.html +++ b/app/node_views/results.html @@ -277,6 +277,34 @@ +
+
F
+
CSS errors
+
+
+
+
CSS files with syntax errors
+
+ {{phantomasResults.metrics.cssParsingErrors}} + +
+
+
+ +

Yellow Lab Tools failed to parse a CSS file. I doubt the problem comes from the css parser.

+

+ Check directly on W3C CSS Validator: +

+
+
+
+
+
+
{{notations.cssComplexity}}
CSS complexity
@@ -339,20 +367,6 @@
Bad CSS
-
-
CSS syntax error
-
- {{phantomasResults.metrics.cssParsingErrors}} - -
-
-
- -

Yellow Lab Tools failed to parse a CSS file. I doubt the problem comes from the css parser.

-

Maybe a CSS validator can help you.

-
-
-
Uses of @import
diff --git a/app/public/scripts/resultsCtrl.js b/app/public/scripts/resultsCtrl.js index 0325b0e..8cc9542 100644 --- a/app/public/scripts/resultsCtrl.js +++ b/app/public/scripts/resultsCtrl.js @@ -64,6 +64,19 @@ app.controller('ResultsCtrl', function ($scope) { } }); + // If there are some CSS parsing errors, prepare the W3C CSS Validator direct URLs + if ($scope.phantomasResults.offenders.cssParsingErrors) { + $scope.cssW3cDirectUrls = []; + $scope.phantomasResults.offenders.cssParsingErrors.forEach(function(errorString, index) { + var stylesheet = errorString.split(' ')[0]; + var w3cUrl = 'http://jigsaw.w3.org/css-validator/validator?profile=css3&usermedium=all&warning=no&vextwarning=true&lang=en&uri=' + encodeURIComponent(stylesheet); + $scope.cssW3cDirectUrls.push({ + url: stylesheet, + w3c: w3cUrl + }); + }); + } + // Grab the notes $scope.notations = { domComplexity: getDomComplexityScore(), @@ -283,9 +296,7 @@ app.controller('ResultsCtrl', function ($scope) { } function getBadCssScore() { - if ($scope.phantomasResults.metrics.cssParsingErrors) { - return 'F'; - } else if (!$scope.phantomasResults.metrics.cssRules) { + if (!$scope.phantomasResults.metrics.cssRules) { return 'NA'; } From 5b2bf8956aa58fac812add796390da503e823ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Thu, 20 Nov 2014 11:19:18 +0100 Subject: [PATCH 2/5] #2 Give a A grade if no syntax error --- app/node_views/results.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/node_views/results.html b/app/node_views/results.html index e017095..e6b414a 100644 --- a/app/node_views/results.html +++ b/app/node_views/results.html @@ -277,10 +277,12 @@
-
-
F
-
CSS errors
-
+
+
F
+
F
+
CSS syntax errors
+
+
CSS files with syntax errors
@@ -289,8 +291,8 @@
-
- +
+

Yellow Lab Tools failed to parse a CSS file. I doubt the problem comes from the css parser.

Check directly on W3C CSS Validator: From 041904f4c67c8cb579b22c9b03e99c5583f3d4a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Thu, 20 Nov 2014 11:34:21 +0100 Subject: [PATCH 3/5] Wording improved --- app/node_views/results.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/node_views/results.html b/app/node_views/results.html index e6b414a..9109b2c 100644 --- a/app/node_views/results.html +++ b/app/node_views/results.html @@ -295,7 +295,7 @@

Yellow Lab Tools failed to parse a CSS file. I doubt the problem comes from the css parser.

- Check directly on W3C CSS Validator: + Direct links to the W3C CSS Validator for the following stylesheets:

  • {{stylesheet.url}} From b0b6e71d2ef5ea99b4bb07d8e318e8b841ce354c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Thu, 20 Nov 2014 13:02:49 +0100 Subject: [PATCH 4/5] Fix grade error --- app/node_views/results.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/node_views/results.html b/app/node_views/results.html index 9109b2c..b6fab8d 100644 --- a/app/node_views/results.html +++ b/app/node_views/results.html @@ -278,7 +278,7 @@
-
F
+
A
F
CSS syntax errors
From 2a2d99191d88ed1943a9fabce2d49d6e14ac7dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Thu, 20 Nov 2014 14:41:46 +0100 Subject: [PATCH 5/5] Another warning --- app/node_views/results.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/node_views/results.html b/app/node_views/results.html index b6fab8d..6cab6db 100644 --- a/app/node_views/results.html +++ b/app/node_views/results.html @@ -295,7 +295,7 @@

Yellow Lab Tools failed to parse a CSS file. I doubt the problem comes from the css parser.

- Direct links to the W3C CSS Validator for the following stylesheets: + Direct links to the W3C CSS Validator for the following stylesheet(s):

+
+
( couldn't be parsed)
+
+
+
@@ -534,6 +539,11 @@
+
+
( couldn't be parsed)
+
+
+