From 3f9733342332aaa67edbef16437e23b3f3bc2a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Sat, 26 Mar 2016 10:25:09 +0200 Subject: [PATCH 1/5] Test different versions of Node in Travis --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3bf526f..10a882e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,8 @@ language: node_js sudo: false node_js: - - "0.12.4" + - "5.8" + - "0.12" before_install: - "npm install -g npm" - "npm install -g grunt-cli" From b7e25c4e1ccfa4a2ffe0677895284c726f8d3a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Sat, 26 Mar 2016 10:25:28 +0200 Subject: [PATCH 2/5] Update Phantomas to v1.15 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 77152ed..d5b43b8 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "meow": "3.6.0", "minimize": "1.7.4", "parse-color": "1.0.0", - "phantomas": "git://github.com/gmetais/phantomas.git#fix-about-blank", + "phantomas": "1.15.0", "ps-node": "0.0.5", "q": "1.4.1", "request": "2.67.0", From 74c57fc11cfee665cdf94d54e35d5087753fdfb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Sat, 26 Mar 2016 10:49:17 +0200 Subject: [PATCH 3/5] Add offenders to CSSRules --- front/src/views/rule.html | 6 ++++++ lib/metadata/policies.js | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/front/src/views/rule.html b/front/src/views/rule.html index 7301e85..d6a83e8 100644 --- a/front/src/views/rule.html +++ b/front/src/views/rule.html @@ -96,6 +96,12 @@ +
+ inline CSS + + : +
+
{{offender.color1}}
{{offender.color2}}
diff --git a/lib/metadata/policies.js b/lib/metadata/policies.js index c2f2bc0..9c7b9e2 100644 --- a/lib/metadata/policies.js +++ b/lib/metadata/policies.js @@ -424,7 +424,40 @@ var policies = { "isOkThreshold": 750, "isBadThreshold": 3000, "isAbnormalThreshold": 4500, - "hasOffenders": false + "hasOffenders": true, + "offendersTransformFn": function(offenders) { + var hasInline = false; + var inlineCount = 0; + var files = []; + + offenders.forEach(function(line) { + if (line.indexOf('[inline CSS]: ') === 0) { + hasInline = true; + inlineCount += parseInt(line.substr(14)); + } else { + var parts = /^<(.*)>: (\d+)$/.exec(line); + + if (parts) { + files.push({ + file: parts[1], + rules: parseInt(parts[2], 10) + }); + } + } + }); + + if (hasInline) { + files.push({ + file: 'inline CSS', + rules: inlineCount + }); + } + + return { + count: files.length, + list: files + }; + } }, "cssComplexSelectors": { "tool": "phantomas", From aaa1ad7eaa11c170a04355983f585ffacf69342b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Sat, 26 Mar 2016 11:41:51 +0200 Subject: [PATCH 4/5] Update other dependecies --- package.json | 62 ++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index d5b43b8..b246e22 100644 --- a/package.json +++ b/package.json @@ -20,52 +20,52 @@ }, "main": "./lib/index.js", "dependencies": { - "angular": "1.4.8", - "angular-animate": "1.4.8", - "angular-chart.js": "0.8.8", - "angular-local-storage": "0.2.2", - "angular-resource": "1.4.8", - "angular-route": "1.4.8", - "angular-sanitize": "1.4.8", - "async": "1.5.0", - "body-parser": "1.14.2", + "angular": "1.5.2", + "angular-animate": "1.5.2", + "angular-chart.js": "0.9.0", + "angular-local-storage": "0.2.7", + "angular-resource": "1.5.2", + "angular-route": "1.5.2", + "angular-sanitize": "1.5.2", + "async": "1.5.2", + "body-parser": "1.15.0", "chart.js": "1.0.2", - "clean-css": "3.4.8", - "color-diff": "0.1.7", - "compression": "1.6.0", + "clean-css": "3.4.10", + "color-diff": "1.0.0", + "compression": "1.6.1", "cors": "2.7.1", "css-mq-parser": "0.0.3", "debug": "2.2.0", "easyxml": "2.0.1", - "express": "4.13.3", + "express": "4.13.4", "imagemin": "4.0.0", "imagemin-jpegoptim": "4.1.0", "is-http2": "1.0.4", "lwip": "0.0.8", - "meow": "3.6.0", - "minimize": "1.7.4", + "meow": "3.7.0", + "minimize": "1.8.1", "parse-color": "1.0.0", "phantomas": "1.15.0", "ps-node": "0.0.5", "q": "1.4.1", - "request": "2.67.0", - "rimraf": "2.4.4", + "request": "2.69.0", + "rimraf": "2.5.2", "temporary": "0.0.8", "try-thread-sleep": "1.0.0", - "uglify-js": "2.6.1" + "uglify-js": "2.6.2" }, "devDependencies": { - "chai": "~3.4.0", + "chai": "~3.5.0", "grunt": "~0.4.5", "grunt-blanket": "~0.0.10", - "grunt-contrib-clean": "~0.7.0", - "grunt-contrib-concat": "~0.5.1", - "grunt-contrib-copy": "~0.8.2", - "grunt-contrib-cssmin": "~0.14.0", - "grunt-contrib-htmlmin": "~0.6.0", - "grunt-contrib-jshint": "~0.11.3", - "grunt-contrib-less": "~1.1.0", - "grunt-contrib-uglify": "~0.11.0", + "grunt-contrib-clean": "~1.0.0", + "grunt-contrib-concat": "~1.0.0", + "grunt-contrib-copy": "~1.0.0", + "grunt-contrib-cssmin": "~1.0.1", + "grunt-contrib-htmlmin": "~1.1.0", + "grunt-contrib-jshint": "~1.0.0", + "grunt-contrib-less": "~1.2.0", + "grunt-contrib-uglify": "~1.0.1", "grunt-env": "~0.4.4", "grunt-express": "~1.4.1", "grunt-filerev": "~2.3.1", @@ -74,10 +74,10 @@ "grunt-mocha-test": "~0.12.7", "grunt-replace": "~0.11.0", "grunt-usemin": "~3.1.1", - "grunt-webfont": "~1.1.0", - "matchdep": "~1.0.0", - "mocha": "~2.3.2", - "sinon": "~1.17.2", + "grunt-webfont": "~1.2.0", + "matchdep": "~1.0.1", + "mocha": "~2.4.5", + "sinon": "~1.17.3", "sinon-chai": "~2.8.0" }, "scripts": { From 8eec2549a49bb8adfec54e372ed98166dc0583b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Sat, 26 Mar 2016 12:00:11 +0200 Subject: [PATCH 5/5] Trying to fix Travis build for Node 5.* --- .travis.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 10a882e..b29d5f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,18 @@ language: node_js sudo: false node_js: - - "5.8" - - "0.12" + - "5.8" + - "0.12" +env: + - CXX=g++-4.8 +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.8 before_install: - - "npm install -g npm" - - "npm install -g grunt-cli" + - "npm install -g npm" + - "npm install -g grunt-cli" install: - - "npm install" \ No newline at end of file + - "npm install" \ No newline at end of file