From 9376803f407e735c39941061c6e0aedb8bc90321 Mon Sep 17 00:00:00 2001 From: Inga Lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Mon, 27 Feb 2017 16:36:33 +0300 Subject: [PATCH] Code style fixes --- BuildServer/lib/commenter.ts | 4 ++-- BuildServer/lib/git/loader.ts | 6 +++--- BuildServer/lib/tasks/index.ts | 2 +- BuildServer/routes/postreceive.ts | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/BuildServer/lib/commenter.ts b/BuildServer/lib/commenter.ts index 1504347..0f3fc20 100644 --- a/BuildServer/lib/commenter.ts +++ b/BuildServer/lib/commenter.ts @@ -13,7 +13,7 @@ const maxCommentLength = 64000; const writeComment = (options, message, callback) => options.github.issues.createComment({ "body": message, - "number": options.number, + "number": options.pullRequestNumber, "owner": options.baseRepoOptions.owner, "repo": options.baseRepoOptions.reponame }, callback); @@ -24,7 +24,7 @@ const closePullRequest = (options, message, callback) => writeComment(options, m } return options.github.issues.edit({ - "number": options.number, + "number": options.pullRequestNumber, "owner": options.baseRepoOptions.owner, "repo": options.baseRepoOptions.reponame, "state": "closed" diff --git a/BuildServer/lib/git/loader.ts b/BuildServer/lib/git/loader.ts index 751604e..a98d9ba 100644 --- a/BuildServer/lib/git/loader.ts +++ b/BuildServer/lib/git/loader.ts @@ -38,9 +38,9 @@ export const gitLoader = (options, globalCallback) => { .catch(globalCallback) .then((remote) => remote.fetch([options.branch]) .catch(globalCallback) - .then((number) => { - if (number) { - return globalCallback(`Failed to fetch commit: error number ${number}`); + .then((errorNumber) => { + if (errorNumber) { + return globalCallback(`Failed to fetch commit: error number ${errorNumber}`); } console.log(`Cloned ${url} to ${path}`); diff --git a/BuildServer/lib/tasks/index.ts b/BuildServer/lib/tasks/index.ts index 2f97c8e..c53c39c 100644 --- a/BuildServer/lib/tasks/index.ts +++ b/BuildServer/lib/tasks/index.ts @@ -1,6 +1,6 @@ "use strict"; -var tasks = {}; +let tasks = {}; // Code taken from http://stackoverflow.com/a/17204293 // eslint-disable-next-line no-sync diff --git a/BuildServer/routes/postreceive.ts b/BuildServer/routes/postreceive.ts index ab68958..504516d 100644 --- a/BuildServer/routes/postreceive.ts +++ b/BuildServer/routes/postreceive.ts @@ -28,7 +28,7 @@ const processPush = (req, res, payload) => { const processPullRequest = (req, res, payload) => { const action = payload.action; - const number = payload.number; + const pullRequestNumber = payload.number; const pullRequest = payload.pull_request; const head = pullRequest.head; const headRepo = head.repo; @@ -52,14 +52,14 @@ const processPullRequest = (req, res, payload) => { "app": req.app, baseRepoOptions, headRepoOptions, - number + pullRequestNumber }; const masterOptions = { action, "app": req.app, baseRepoOptions, "headRepoOptions": baseRepoOptions, - number + pullRequestNumber }; console.log(`Got pull request ${action} event, ` @@ -97,7 +97,7 @@ const getPayload = (body) => { } return JSONParse(body.payload).value; -} +}; export default (req, res) => { if (!req.body || (!req.body.payload && !req.body.repository)) {