From d5a4d05a4b8eb73cb72af895cf04e23d247652c7 Mon Sep 17 00:00:00 2001 From: mahabaleshwars <147705296+mahabaleshwars@users.noreply.github.com> Date: Thu, 6 Mar 2025 16:36:53 +0530 Subject: [PATCH] optimize code --- dist/setup/index.js | 7 ++----- src/utils.ts | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 78aa6216..60c6ab9d 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -100729,7 +100729,6 @@ function getVersionInputFromToolVersions(versionFile) { try { const fileContents = fs_1.default.readFileSync(versionFile, 'utf8'); const lines = fileContents.split('\n'); - const versions = []; for (const line of lines) { // Skip commented lines if (line.trim().startsWith('#')) { @@ -100740,10 +100739,8 @@ function getVersionInputFromToolVersions(versionFile) { return [((_a = match.groups) === null || _a === void 0 ? void 0 : _a.version.trim()) || '']; } } - if (versions.length === 0) { - core.warning(`No Python version found in ${versionFile}`); - } - return versions; + core.warning(`No Python version found in ${versionFile}`); + return []; } catch (error) { core.error(`Error reading ${versionFile}: ${error.message}`); diff --git a/src/utils.ts b/src/utils.ts index fde719e3..6274895e 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -290,7 +290,6 @@ export function getVersionInputFromToolVersions(versionFile: string): string[] { try { const fileContents = fs.readFileSync(versionFile, 'utf8'); const lines = fileContents.split('\n'); - const versions: string[] = []; for (const line of lines) { // Skip commented lines @@ -303,11 +302,9 @@ export function getVersionInputFromToolVersions(versionFile: string): string[] { } } - if (versions.length === 0) { - core.warning(`No Python version found in ${versionFile}`); - } + core.warning(`No Python version found in ${versionFile}`); - return versions; + return []; } catch (error) { core.error(`Error reading ${versionFile}: ${(error as Error).message}`); return [];