You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by gu...@apache.org on 2017/10/17 08:26:01 UTC

[48/50] incubator-weex git commit: * [test] vilid protect for danger ci

* [test] vilid protect for danger ci


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/4326a6fc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/4326a6fc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/4326a6fc

Branch: refs/heads/release-0.16
Commit: 4326a6fcaaf4797e6e675cb60dd43ac985897cc9
Parents: c4175b7
Author: gurisxie <27...@qq.com>
Authored: Tue Oct 17 16:02:38 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Tue Oct 17 16:02:38 2017 +0800

----------------------------------------------------------------------
 dangerfile.js | 36 ++++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/4326a6fc/dangerfile.js
----------------------------------------------------------------------
diff --git a/dangerfile.js b/dangerfile.js
index 83a0ef1..23da68a 100644
--- a/dangerfile.js
+++ b/dangerfile.js
@@ -320,6 +320,7 @@ function findReviewer(resolve, reject) {
       resolve()
       return
     }
+    console.log('result:'+result);
     parseDeleteAndNormalLines(result.data, fileToDeletedLinesMap, fileToNormalLinesMap)
     console.log('getContent')
     var promises = danger.git.modified_files.map(function(file) {
@@ -374,22 +375,29 @@ function getContent(url) {
 
 function parseDeleteAndNormalLines(diffData, fileToDeletedLinesMap, fileToNormalLinesMap) {
   try {
-    console.log('diffData:'+diffData)
+    console.log('parseDeleteAndNormalLines')
     var diffs = parseDiff(diffData)
-    diffs.forEach(diff => {
-      fileToDeletedLinesMap[diff.from] = [];
-      fileToNormalLinesMap[diff.from] = [];
-      diff.chunks.forEach(chunk => {
-        chunk.changes.forEach(change => {
-          if (change.del) {
-            fileToDeletedLinesMap[diff.from].push(change.ln)
-          }
-          if (change.normal) {
-            fileToNormalLinesMap[diff.from].push(change.ln1)
-          }
-        })
+    console.log('diffs:'+diffs)
+    if(diffs&&diffs instanceof Array){
+      diffs.forEach(diff => {
+        fileToDeletedLinesMap[diff.from] = [];
+        fileToNormalLinesMap[diff.from] = [];
+        if(diff&&diff.chunks&&diff.chunks instanceof Array){
+          diff.chunks.forEach(chunk => {
+            if(chunk&&chunk.changes&&chunk.changes instanceof Array){
+              chunk.changes.forEach(change => {
+                if (change&&change.del) {
+                  fileToDeletedLinesMap[diff.from].push(change.ln)
+                }
+                if (change&&change.normal) {
+                  fileToNormalLinesMap[diff.from].push(change.ln1)
+                }
+              })
+            }
+          })
+        }
       })
-    })
+    }
   } catch (error) {
     console.log(error)
   }