From b2fee6a6c196f2ed2788444ad2387fba8f6df9cb Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Sun, 24 May 2020 12:37:54 +0200 Subject: Use an arrow function inside forEach() instead of an anonymous function Suggested by deepcode.ai. --- client/components/boards/boardBody.js | 4 ++-- client/components/cards/cardDetails.js | 4 ++-- client/components/sidebar/sidebar.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'client/components') diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 4e473f18..78418f2a 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -365,12 +365,12 @@ BlazeComponent.extendComponent({ }; currentBoard .cardsInInterval(start.toDate(), end.toDate()) - .forEach(function(card) { + .forEach(card => { pushEvent(card); }); currentBoard .cardsDueInBetween(start.toDate(), end.toDate()) - .forEach(function(card) { + .forEach(card => { pushEvent( card, `${card.title} ${TAPi18n.__('card-due')}`, diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 441068b0..a57eddf9 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -805,9 +805,9 @@ Template.copyChecklistToManyCardsPopup.events({ // copy subtasks cursor = Cards.find({ parentId: oldId }); - cursor.forEach(function() { + cursor.forEach(cur => { 'use strict'; - const subtask = arguments[0]; + const subtask = cur; subtask.parentId = _id; subtask._id = null; /* const newSubtaskId = */ Cards.insert(subtask); diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js index 0e535041..7b14c1e0 100644 --- a/client/components/sidebar/sidebar.js +++ b/client/components/sidebar/sidebar.js @@ -653,7 +653,7 @@ BlazeComponent.extendComponent({ 'subtext-with-parent', 'no-parent', ]; - options.forEach(function(element) { + options.forEach(element => { if (element !== value) { $(`#${element} ${MCB}`).toggleClass(CKCLS, false); $(`#${element}`).toggleClass(CKCLS, false); -- cgit v1.2.3-1-g7c22 From cfa2bbd3d4174da6f6f6ae7aa5830fc883428629 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Sun, 24 May 2020 12:48:36 +0200 Subject: Fix false positive found by deepcode.ai --- client/components/rules/actions/cardActions.js | 1 + 1 file changed, 1 insertion(+) (limited to 'client/components') diff --git a/client/components/rules/actions/cardActions.js b/client/components/rules/actions/cardActions.js index 7dc6c2b5..2290249c 100644 --- a/client/components/rules/actions/cardActions.js +++ b/client/components/rules/actions/cardActions.js @@ -164,6 +164,7 @@ BlazeComponent.extendComponent({ const boardId = Session.get('currentBoard'); const actionId = Actions.insert({ actionType: 'removeMember', + // deepcode ignore NoHardcodedCredentials: it's no credential username: '*', boardId, desc, -- cgit v1.2.3-1-g7c22 From fc9f0d83921a526ca81c73381ac93cfcb9bb6fd9 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Sun, 24 May 2020 12:53:15 +0200 Subject: Sort callback should return 0 if values are equal Fixes: "The callback [:381] provided to sort [:381] should return 0 if the compared values are equal." --- client/components/boards/boardBody.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'client/components') diff --git a/client/components/boards/boardBody.js b/client/components/boards/boardBody.js index 78418f2a..e70faa49 100644 --- a/client/components/boards/boardBody.js +++ b/client/components/boards/boardBody.js @@ -378,8 +378,8 @@ BlazeComponent.extendComponent({ new Date(card.dueAt.getTime() + 36e5), ); }); - events.sort(function(first, second) { - return first.id > second.id ? 1 : -1; + events.sort((first, second) => { + return first.id === second.id ? 0 : first.id > second.id ? 1 : -1; }); callback(events); }, -- cgit v1.2.3-1-g7c22