Преглед на файлове

Merge pull request #146 from gmetais/phantomas-1.15

Update dependencies
Gaël Métais преди 9 години
родител
ревизия
b8560c6e15
променени са 4 файла, в които са добавени 85 реда и са изтрити 37 реда
  1. 13 4
      .travis.yml
  2. 6 0
      front/src/views/rule.html
  3. 34 1
      lib/metadata/policies.js
  4. 32 32
      package.json

+ 13 - 4
.travis.yml

@@ -1,9 +1,18 @@
 language: node_js
 sudo: false
 node_js:
-    - "0.12.4"
+  - "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"
+  - "npm install"

+ 6 - 0
front/src/views/rule.html

@@ -96,6 +96,12 @@
                         </span>
                     </div>
 
+                    <div ng-if="policyName === 'cssRules'">
+                        <span ng-if="offender.file === 'inline CSS'">inline CSS</span>
+                        <span ng-if="offender.file !== 'inline CSS'"><url-link url="offender.file" max-length="80"></url-link></span>
+                        : <ng-pluralize count="offender.rules" when="{'0': '0 rule', 'one':'1 rule','other':'{} rules'}"></ng-pluralize>
+                    </div>
+
                     <div ng-if="policyName === 'similarColors'">
                         <div class="similarColors checker"><div ng-style="{'background-color': offender.color1, 'color': offender.isDark ? '#FFF' : '#000'}">{{offender.color1}}</div><div ng-style="{'background-color': offender.color2, 'color': offender.isDark ? '#FFF' : '#000'}">{{offender.color2}}</div></div>
                     </div>

+ 34 - 1
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",

+ 32 - 32
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": "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",
-    "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": {