From 9bb81400132a8c7c06057c559bdab3e1b354bf81 Mon Sep 17 00:00:00 2001 From: Manon Faour Date: Mon, 7 Aug 2023 12:54:14 +0100 Subject: [PATCH] fix: explicit exit code and return in review index --- src/common/git/getFilesWithChanges.ts | 2 +- src/review/index.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/common/git/getFilesWithChanges.ts b/src/common/git/getFilesWithChanges.ts index 0a5a8c68..e70812e2 100644 --- a/src/common/git/getFilesWithChanges.ts +++ b/src/common/git/getFilesWithChanges.ts @@ -15,7 +15,7 @@ export const getFilesWithChanges = async ( logger.warn( "No files with changes found, you might need to stage your changes." ); - exit(); + exit(0); } const files = await Promise.all( diff --git a/src/review/index.ts b/src/review/index.ts index b0e845d2..45c74bff 100644 --- a/src/review/index.ts +++ b/src/review/index.ts @@ -10,7 +10,10 @@ import { askAI } from "./llm/askAI"; import { constructPromptsArray } from "./prompt/constructPrompt/constructPrompt"; import { filterFiles } from "./prompt/filterFiles"; -export const review = async (yargs: ReviewArgs, files: ReviewFile[]) => { +export const review = async ( + yargs: ReviewArgs, + files: ReviewFile[] +): Promise => { logger.debug(`Review started.`); logger.debug(`Model used: ${yargs.model}`); logger.debug(`Ci enabled: ${yargs.ci}`); @@ -25,8 +28,8 @@ export const review = async (yargs: ReviewArgs, files: ReviewFile[]) => { const filteredFiles = filterFiles(files); if (filteredFiles.length == 0) { - logger.info("No file to review, exiting now."); - exit(); + logger.info("No file to review, finishing review now."); + return; } logger.debug(