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/18 04:17:21 UTC
[43/50] [abbrv] incubator-weex git commit: * [test] valid protect for
danger file
* [test] valid protect for danger file
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/e2a373f7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/e2a373f7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/e2a373f7
Branch: refs/heads/master
Commit: e2a373f7ac9bdece27ba5b18072ecfc3b50e133a
Parents: 1c2369b
Author: gurisxie <27...@qq.com>
Authored: Tue Oct 17 16:05:43 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Tue Oct 17 16:05:43 2017 +0800
----------------------------------------------------------------------
dangerfile.js | 36 ++++++++++++++++++++++--------------
1 file changed, 22 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e2a373f7/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)
}