Code analysis bot does not need to comment on merge commits

Summary:
This PR fixes a CI issue that came up on #11304 after merging master into the pr branch.

That created a merge commit with over 1000 changed files. That might have created irrelevant comments, but the github commit api is limited to 300 files, with only the first 294 having the expected diffs included.

I can't think of any reasonable scenario where a merge would have changes that aren't either on master or another commit in the PR, so I've updated it to treat merge commits as having no changes.
Closes https://github.com/facebook/react-native/pull/13260

Differential Revision: D4819805

Pulled By: ericvicenti

fbshipit-source-id: 7b6b51b18bb36503a719a3ba5c9163cd6ef00e17
This commit is contained in:
Tom Clarkson 2017-04-03 11:08:16 -07:00 коммит произвёл Facebook Github Bot
Родитель 10cb0f9325
Коммит 8a760e0a93
1 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -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);