@@ -245,19 +245,17 @@ def _get_repo_metadata(self, repo_path: Path, repo_url: str) -> RepoMetadata:
245245 language_breakdown = lang_breakdown ,
246246 )
247247
248- async def _run_scanners (self , repo_path : Path ) -> dict [str , Any ]:
248+ async def _run_scanners (self , repo_path : Path , stack_result : StackDetection ) -> dict [str , Any ]:
249249 """
250- Run all scanners. Stack detection runs first, then the rest in parallel .
250+ Run all scanners. Stack detection is already done, passed as parameter .
251251
252252 Args:
253253 repo_path: Path to cloned repository.
254+ stack_result: Pre-computed stack detection result.
254255
255256 Returns:
256257 Dictionary of scanner results.
257258 """
258- # Phase 1: Stack detection (needed for metadata and downstream consumers)
259- stack_result = detect_stack (repo_path )
260-
261259 # Phase 2: Run remaining scanners in parallel
262260 loop = asyncio .get_event_loop ()
263261
@@ -352,7 +350,7 @@ def _add_phase(name: str, status: PhaseStatus, started: datetime | None = None,
352350 # Get metadata
353351 repo_metadata = self ._get_repo_metadata (repo_path , validated_url )
354352
355- # Run stack detection
353+ # Run stack detection (ONCE — result passed to _run_scanners)
356354 stack_start = datetime .now (timezone .utc )
357355 _add_phase ("stack_detection" , PhaseStatus .RUNNING , started = stack_start )
358356 try :
@@ -364,13 +362,13 @@ def _add_phase(name: str, status: PhaseStatus, started: datetime | None = None,
364362 _add_phase ("stack_detection" , PhaseStatus .FAILED , started = stack_start , completed = stack_end , err = str (exc ))
365363 stack_result = StackDetection (primary_language = "unknown" , confidence = 0.0 )
366364
367- # Run remaining scanners in parallel
365+ # Run remaining scanners in parallel (stack_result passed, not re-detected)
368366 scan_start = datetime .now (timezone .utc )
369367 for name in ["sast" , "secrets" , "dependencies" , "dockerfile_scan" , "sbom" ]:
370368 _add_phase (name , PhaseStatus .RUNNING , started = scan_start )
371369
372370 try :
373- results = await self ._run_scanners (repo_path )
371+ results = await self ._run_scanners (repo_path , stack_result )
374372 scan_end = datetime .now (timezone .utc )
375373 for name in ["sast" , "secrets" , "dependencies" , "dockerfile_scan" , "sbom" ]:
376374 _add_phase (name , PhaseStatus .COMPLETED , started = scan_start , completed = scan_end )
0 commit comments