From aa47b161561ae7cc451074d8c26b3ae35fb56644 Mon Sep 17 00:00:00 2001 From: Randell Dawson Date: Fri, 9 Nov 2018 20:17:45 -0800 Subject: [PATCH] fix: corrected guideFolderChecks reduce --- guideFolderChecks.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/guideFolderChecks.js b/guideFolderChecks.js index adb35135ab..a8f967657f 100644 --- a/guideFolderChecks.js +++ b/guideFolderChecks.js @@ -75,13 +75,16 @@ const checkPath = fullPath => { return errorMsgs; }; -const guideFolderChecks = (fullPath, user) => { - if (/^guide\//.test(fullPath)) { - const errors = checkPath(fullPath); - if (errors.length) { - return createErrorMsg(errors, user); +const guideFolderChecks = (prFiles, user) => { + const prErrors = prFiles.reduce((errorsFound, { filename: fullPath }) => { + let newErrors; + if (/^guide\//.test(fullPath)) { + newErrors = checkPath(fullPath); } - } + return newErrors ? errorsFound.concat(newErrors) : errorsFound; + }, []); + + return createErrorMsg(prErrors, user); }; exports.guideFolderChecks = guideFolderChecks;