Skip to content

Commit 531a19b

Browse files
committed
rename all items => relative identifiers
1 parent 6774c07 commit 531a19b

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

src/index.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function checkForParsableGithubLink(message) {
8989
return [true, owner, name, type, id];
9090
}
9191

92-
return [ false ];
92+
return [false];
9393
}
9494

9595
/**
@@ -333,34 +333,34 @@ async function parseGithubLink(message, parsable) {
333333
*/
334334
async function parseQuery(members, response) {
335335
const parsedCardData = await Promise.all(
336-
await response.map(async (items) => {
336+
await response.map(async (cardData) => {
337337
try {
338-
if (Utils.isPropertyExist(items, 'state')) {
339-
if (items.state === 'NOTE_ONLY') {
340-
if (Utils.isPropertyExist(items, 'note') && Utils.isPropertyExist(items, 'creator')) {
338+
if (Utils.isPropertyExist(cardData, 'state')) {
339+
if (cardData.state === 'NOTE_ONLY') {
340+
if (Utils.isPropertyExist(cardData, 'note') && Utils.isPropertyExist(cardData, 'creator')) {
341341
for (let i = 0; i < members.length; i++) {
342-
if (items.note.includes(`@${members[i].name}`)) {
343-
const parsable = checkForParsableGithubLink(items.note);
342+
if (cardData.note.includes(`@${members[i].name}`)) {
343+
const parsable = checkForParsableGithubLink(cardData.note);
344344

345345
return parsable[0]
346-
? await parseGithubLink(items.note, parsable)
347-
: escapeChars(items.note);
346+
? await parseGithubLink(cardData.note, parsable)
347+
: escapeChars(cardData.note);
348348
}
349349
}
350-
const parsable = checkForParsableGithubLink(items.note);
350+
const parsable = checkForParsableGithubLink(cardData.note);
351351

352352
return parsable[0]
353-
? await parseGithubLink(items.note, parsable)
354-
: `${items.note} @${items.creator.login}`;
353+
? await parseGithubLink(cardData.note, parsable)
354+
: `${cardData.note} @${cardData.creator.login}`;
355355
}
356-
} else if (items.state === 'CONTENT_ONLY') {
357-
if (Utils.isPropertyExist(items, 'content', '__typename')) {
358-
if (items.content.__typename === 'PullRequest') {
359-
return pullRequestParser(items.content);
356+
} else if (cardData.state === 'CONTENT_ONLY') {
357+
if (Utils.isPropertyExist(cardData, 'content', '__typename')) {
358+
if (cardData.content.__typename === 'PullRequest') {
359+
return pullRequestParser(cardData.content);
360360
}
361361

362-
if (items.content.__typename === 'Issue') {
363-
return issuesParser(items.content);
362+
if (cardData.content.__typename === 'Issue') {
363+
return issuesParser(cardData.content);
364364
}
365365
}
366366
}
@@ -369,13 +369,13 @@ async function parseQuery(members, response) {
369369
}
370370
} catch (e) {
371371
HawkCatcher.send(e, {
372-
cardData: items,
372+
cardData: cardData,
373373
});
374374
}
375375
})
376376
).catch(HawkCatcher.send);
377377

378-
let cardDataWithoutMembers = [ ...parsedCardData ];
378+
let cardDataWithoutMembers = [...parsedCardData];
379379

380380
for (let i = 0; i < members.length; i++) {
381381
cardDataWithoutMembers = cardDataWithoutMembers.map((x) =>
@@ -386,9 +386,9 @@ async function parseQuery(members, response) {
386386
x.replace(/^\s+|\s+$/g, '')
387387
);
388388

389-
parsedCardData.forEach((items, index) => {
389+
parsedCardData.forEach((cardData, index) => {
390390
for (let i = 0; i < members.length; i++) {
391-
if (items.includes(`@${members[i].name}`)) {
391+
if (cardData.includes(`@${members[i].name}`)) {
392392
members[i].tasks.push(cardDataWithoutMembers[index]);
393393
}
394394
}
@@ -407,9 +407,9 @@ function getMembersName(memberList) {
407407
const members = [];
408408

409409
if (memberList) {
410-
memberList.split(' ').forEach((items) => {
410+
memberList.split(' ').forEach((memberName) => {
411411
members.push({
412-
name: items,
412+
name: memberName,
413413
tasks: [],
414414
});
415415
});
@@ -418,9 +418,9 @@ function getMembersName(memberList) {
418418
}
419419

420420
return octokit.graphql(MEMBERS_QUERY).then((query) => {
421-
query.organization.membersWithRole.nodes.forEach((items) => {
421+
query.organization.membersWithRole.nodes.forEach(({ login }) => {
422422
members.push({
423-
name: items.login,
423+
name: login,
424424
tasks: [],
425425
});
426426
});
@@ -451,19 +451,19 @@ async function notifyMessage(title, columnID, includePersonWithNoTask = false) {
451451
}
452452
const personWithNoTask = [];
453453

454-
parsedData.forEach((items) => {
454+
parsedData.forEach(({ tasks, name }) => {
455455
/** Skip person with no tasks */
456-
if (!items.tasks.length) {
457-
if (includePersonWithNoTask && items.name != 'dependabot') {
458-
personWithNoTask.push(items.name);
456+
if (!tasks.length) {
457+
if (includePersonWithNoTask && name != 'dependabot') {
458+
personWithNoTask.push(name);
459459
}
460460

461461
return;
462462
}
463463

464-
dataToSend += `<b>${items.name}</b>\n`;
464+
dataToSend += `<b>${name}</b>\n`;
465465

466-
items.tasks.forEach((data) => {
466+
tasks.forEach((data) => {
467467
dataToSend += `• ${data}\n`;
468468
});
469469

@@ -491,8 +491,8 @@ async function notifyMessage(title, columnID, includePersonWithNoTask = false) {
491491
function parseMeetingMessage(mentionList) {
492492
let message = `☝️ Join the meeting in Discord!\n\n`;
493493

494-
mentionList.split(' ').forEach((items) => {
495-
message += `@${items} `;
494+
mentionList.split(' ').forEach((mentionName) => {
495+
message += `@${mentionName} `;
496496
});
497497

498498
return message;

0 commit comments

Comments
 (0)