From b9c2221cc9ab90fa181ddc90fe38b84449a039fc Mon Sep 17 00:00:00 2001 From: Denis Ah-Kang Date: Thu, 21 Jun 2018 12:30:51 +0400 Subject: [PATCH] fix jscs errors --- .jscs.json | 1 - lib/orchestrator.js | 1 - lib/transition-checker.js | 29 ++++++++++++++++------------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.jscs.json b/.jscs.json index e76594d1..e04347b7 100644 --- a/.jscs.json +++ b/.jscs.json @@ -31,7 +31,6 @@ "disallowTrailingWhitespace": true, "maximumLineLength": 160, "requireBlocksOnNewline": 1, - "requireCamelCaseOrUpperCaseIdentifiers": true, "requireCapitalizedComments": true, "requireCapitalizedConstructors": true, "requireCommaBeforeLineBreak": true, diff --git a/lib/orchestrator.js b/lib/orchestrator.js index ad122669..908d3127 100644 --- a/lib/orchestrator.js +++ b/lib/orchestrator.js @@ -356,7 +356,6 @@ Orchestrator.prototype.runTransitionChecker = function (profile, latestVersion, }); }; - Orchestrator.prototype.runTokenChecker = function (latestVersion, url, token) { return new Map({ name: 'token-checker', diff --git a/lib/transition-checker.js b/lib/transition-checker.js index cb2873d0..ff9f6038 100644 --- a/lib/transition-checker.js +++ b/lib/transition-checker.js @@ -16,19 +16,20 @@ var TransitionChecker = {}; TransitionChecker.check = function (profile, latestVersion, previousVersion, isEditorial, isUpdate) { return new Promise(function (resolve, reject) { var errors = new List(); + if (profile === 'WD' || profile === 'WG-NOTE' || isUpdate) { resolve(errors); } else if (profile === 'CR') { - if (previousVersion.includes("/WD-") || !isEditorial) { + if (previousVersion.includes('/WD-') || !isEditorial) { var octo = new Octokat({ token: global.GH_TOKEN }); var repo = octo.repos('w3c', 'transitions'); var shortname = latestVersion.match(new RegExp(/.*\/([^/]+)\/$/))[1]; - var directorApproval = "Transition approved."; - var commApproval = "Draft transition approved." + var directorApproval = 'Transition approved.'; + var commApproval = 'Draft transition approved.'; var directorApprovalFound = false; var commApprovalFound = false; @@ -36,33 +37,35 @@ TransitionChecker.check = function (profile, latestVersion, previousVersion, isE { labels: 'Awaiting publication', state: 'open', - per_page: 100 // TODO: get all the issues, not just the first 100 + per_page: 100 // TODO: get all the issues, not just the first 100 }) - .then((content) => { + .then((content) => { for (var issue of content.items) { if (issue.title.endsWith(' ' + shortname)) { repo.issues(issue.number).comments.fetch() .then((comments) => { for (var comment of comments.items) { if (comment.body.startsWith(directorApproval)) { - // director's approval + // Director's approval octo.teams(global.GH_DIRECTOR_TEAM_ID).members(comment.user.login).fetch((err, res) => { if (!err) directorApprovalFound = true; }); - } else if (comment.body.startsWith(commApproval)) { - // comm's approval + } + else if (comment.body.startsWith(commApproval)) { + // Comm's approval octo.teams(global.GH_COMM_TEAM_ID).members(comment.user.login).fetch((err, res) => { if (!err) commApprovalFound = true; }); } } - if (!directorApprovalFound) errors.push("Director's approval not found".); - if (!commApprovalFound) errors.push("Communication team's approval not found."); + if (!directorApprovalFound) errors.push('Director\'s approval not found.'); + if (!commApprovalFound) errors.push('Communication team\'s approval not found.'); resolve(errors); }); - } else { - // issue not found - reject(new Error("Issue not found on the github repository w3c/transitions.")); + } + else { + // Issue not found + reject(new Error('Issue not found on the github repository w3c/transitions.')); } } });