Skip to content

Commit

Permalink
fix jscs errors
Browse files Browse the repository at this point in the history
  • Loading branch information
deniak committed Jun 21, 2018
1 parent 8afb76a commit b9c2221
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
1 change: 0 additions & 1 deletion .jscs.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"disallowTrailingWhitespace": true,
"maximumLineLength": 160,
"requireBlocksOnNewline": 1,
"requireCamelCaseOrUpperCaseIdentifiers": true,
"requireCapitalizedComments": true,
"requireCapitalizedConstructors": true,
"requireCommaBeforeLineBreak": true,
Expand Down
1 change: 0 additions & 1 deletion lib/orchestrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ Orchestrator.prototype.runTransitionChecker = function (profile, latestVersion,
});
};


Orchestrator.prototype.runTokenChecker = function (latestVersion, url, token) {
return new Map({
name: 'token-checker',
Expand Down
29 changes: 16 additions & 13 deletions lib/transition-checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,53 +16,56 @@ 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;

repo.issues.fetch(
{
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.'));
}
}
});
Expand Down

0 comments on commit b9c2221

Please sign in to comment.