From 3a46c09a096b2e5b9aa0b3c583ee63a592833cf8 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Mon, 12 Jun 2023 10:21:42 +0200 Subject: [PATCH] review --- dist/post_run/index.js | 24 ++++++++++-------------- dist/run/index.js | 24 ++++++++++-------------- src/run.ts | 23 +++++++++++------------ 3 files changed, 31 insertions(+), 40 deletions(-) diff --git a/dist/post_run/index.js b/dist/post_run/index.js index f55778c..721b182 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -66581,21 +66581,17 @@ function runLint(lintPath, patchPath) { .filter((arg) => arg.startsWith(`-`)) .map((arg) => arg.replace(/^-+/, ``)) .map((arg) => arg.split(/=(.*)/, 2)) - .map(([key, value]) => [key, value !== null && value !== void 0 ? value : ""]); + .map(([key, value]) => [key.toLowerCase(), value !== null && value !== void 0 ? value : ""]); const userArgsMap = new Map(userArgsList); - const userArgNames = new Set(userArgsList.map(([key, value]) => key)); - const formats = userArgsMap.get("out-format"); - if (formats) { - if (formats.includes("github-actions")) { - addedArgs.push(`--out-format=${formats}`); - } - else { - addedArgs.push(`--out-format=github-actions,${formats}`); - } - } - else { - addedArgs.push(`--out-format=github-actions`); - } + const userArgNames = new Set(userArgsList.map(([key]) => key)); + const formats = (userArgsMap.get("out-format") || "") + .trim() + .split(",") + .filter((f) => f.length > 0) + .filter((f) => !f.startsWith(`github-actions`)) + .concat("github-actions") + .join(","); + addedArgs.push(`--out-format=${formats}`); if (patchPath) { if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) { throw new Error(`please, don't specify manually --new* args when requesting only new issues`); diff --git a/dist/run/index.js b/dist/run/index.js index 1a60770..09665bc 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -66581,21 +66581,17 @@ function runLint(lintPath, patchPath) { .filter((arg) => arg.startsWith(`-`)) .map((arg) => arg.replace(/^-+/, ``)) .map((arg) => arg.split(/=(.*)/, 2)) - .map(([key, value]) => [key, value !== null && value !== void 0 ? value : ""]); + .map(([key, value]) => [key.toLowerCase(), value !== null && value !== void 0 ? value : ""]); const userArgsMap = new Map(userArgsList); - const userArgNames = new Set(userArgsList.map(([key, value]) => key)); - const formats = userArgsMap.get("out-format"); - if (formats) { - if (formats.includes("github-actions")) { - addedArgs.push(`--out-format=${formats}`); - } - else { - addedArgs.push(`--out-format=github-actions,${formats}`); - } - } - else { - addedArgs.push(`--out-format=github-actions`); - } + const userArgNames = new Set(userArgsList.map(([key]) => key)); + const formats = (userArgsMap.get("out-format") || "") + .trim() + .split(",") + .filter((f) => f.length > 0) + .filter((f) => !f.startsWith(`github-actions`)) + .concat("github-actions") + .join(","); + addedArgs.push(`--out-format=${formats}`); if (patchPath) { if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) { throw new Error(`please, don't specify manually --new* args when requesting only new issues`); diff --git a/src/run.ts b/src/run.ts index a225665..c6ff26f 100644 --- a/src/run.ts +++ b/src/run.ts @@ -125,21 +125,20 @@ async function runLint(lintPath: string, patchPath: string): Promise { .filter((arg) => arg.startsWith(`-`)) .map((arg) => arg.replace(/^-+/, ``)) .map((arg) => arg.split(/=(.*)/, 2)) - .map<[string, string]>(([key, value]) => [key, value ?? ""]) + .map<[string, string]>(([key, value]) => [key.toLowerCase(), value ?? ""]) const userArgsMap = new Map(userArgsList) - const userArgNames = new Set(userArgsList.map(([key, value]) => key)) + const userArgNames = new Set(userArgsList.map(([key]) => key)) - const formats = userArgsMap.get("out-format") - if (formats) { - if (formats.includes("github-actions")) { - addedArgs.push(`--out-format=${formats}`) - } else { - addedArgs.push(`--out-format=github-actions,${formats}`) - } - } else { - addedArgs.push(`--out-format=github-actions`) - } + const formats = (userArgsMap.get("out-format") || "") + .trim() + .split(",") + .filter((f) => f.length > 0) + .filter((f) => !f.startsWith(`github-actions`)) + .concat("github-actions") + .join(",") + + addedArgs.push(`--out-format=${formats}`) if (patchPath) { if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {