From f6573dbb6c5a253358261caf6b36ab693bf0ac8a Mon Sep 17 00:00:00 2001 From: Dylan Pulver Date: Mon, 6 Jan 2025 09:42:02 -0500 Subject: [PATCH] fix/handle-no-ecosystem-case --- safety/scan/command.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/safety/scan/command.py b/safety/scan/command.py index fdfebc8a..4bbba379 100644 --- a/safety/scan/command.py +++ b/safety/scan/command.py @@ -737,8 +737,13 @@ def scan(ctx: typer.Context, path, file_paths = scan_project_directory(file_finder, console) # Step 4: Prepare metadata for analysis - target_ecosystems = ", ".join([member.value for member in ecosystems]) - wait_msg = WAIT_MSG_ANALYZING_TARGETS.format(target_ecosystems) + if ecosystems: + target_ecosystems = ", ".join([member.value for member in ecosystems]) + wait_msg = WAIT_MSG_ANALYZING_TARGETS.format(target_ecosystems) + else: + # Handle the case where no ecosystems are detected + target_ecosystems = "No ecosystems detected" + wait_msg = "Analyzing files and environments for security findings" # Step 5: Initialize data structures and counters for analysis files: List[FileModel] = []