diff --git a/bots/code-analysis-bot.js b/bots/code-analysis-bot.js index d22ffb29a..0c3a8bdda 100644 --- a/bots/code-analysis-bot.js +++ b/bots/code-analysis-bot.js @@ -111,6 +111,11 @@ function getFilesFromCommit(user, repo, sha, callback) { console.log(error); return; } + // A merge commit should not have any new changes to report + if (res.parents && res.parents.length > 1) { + return; + } + callback(res.files); }); } @@ -181,6 +186,10 @@ function main(messages, user, repo, number) { files .filter((file) => messages[file.filename]) .forEach((file) => { + // github api sometimes does not return a patch on large commits + if (!file.patch) { + return; + } var lineMap = getLineMapFromPatch(file.patch); messages[file.filename].forEach((message) => { sendComment(user, repo, number, sha, file.filename, lineMap, message);