(absRoot, ref string, limits blastRadiusLimits)
| 425 | } |
| 426 | |
| 427 | func buildBlastRadiusBundle(absRoot, ref string, limits blastRadiusLimits) (blastRadiusBundle, error) { |
| 428 | diffInfo, err := scanner.GitDiffInfo(absRoot, ref) |
| 429 | if err != nil { |
| 430 | return blastRadiusBundle{}, &blastRadiusDiffError{ref: ref, err: err} |
| 431 | } |
| 432 | |
| 433 | cfg := config.Load(absRoot) |
| 434 | gitCache := scanner.NewGitIgnoreCache(absRoot) |
| 435 | allFiles, err := scanner.ScanFiles(absRoot, gitCache, cfg.Only, cfg.Exclude) |
| 436 | if err != nil { |
| 437 | return blastRadiusBundle{}, err |
| 438 | } |
| 439 | changedFiles := scanner.FilterToChangedWithInfo(allFiles, diffInfo) |
| 440 | diffTotal := len(changedFiles) |
| 441 | |
| 442 | changedSet := make(map[string]bool, diffTotal) |
| 443 | for _, file := range changedFiles { |
| 444 | changedSet[filepath.ToSlash(file.Path)] = true |
| 445 | } |
| 446 | |
| 447 | // Single ast-grep scan shared by impact analysis, the deps project, and the |
| 448 | // file graph below. Previously each of those triggered its own full-repo |
| 449 | // ScanForDeps, tripling latency on large repositories. |
| 450 | var analyses []scanner.FileAnalysis |
| 451 | if diffTotal > 0 { |
| 452 | analyses, err = scanForDepsWithHint(absRoot) |
| 453 | if err != nil { |
| 454 | return blastRadiusBundle{}, err |
| 455 | } |
| 456 | } |
| 457 | |
| 458 | diffProject := scanner.Project{ |
| 459 | Root: absRoot, |
| 460 | Mode: "tree", |
| 461 | Files: changedFiles, |
| 462 | DiffRef: ref, |
| 463 | Impact: scanner.AnalyzeImpactFromAnalyses(changedFiles, analyses), |
| 464 | Depth: cfg.Depth, |
| 465 | Only: cfg.Only, |
| 466 | Exclude: cfg.Exclude, |
| 467 | } |
| 468 | diffCapped := capBlastRadiusProject(diffProject, limits.MaxChangedFiles) |
| 469 | |
| 470 | depsProject := scanner.DepsProject{ |
| 471 | Root: absRoot, |
| 472 | Mode: "deps", |
| 473 | Files: nil, |
| 474 | ExternalDeps: map[string][]string{}, |
| 475 | DiffRef: ref, |
| 476 | } |
| 477 | depsCapped := depsProject |
| 478 | depsTotal := 0 |
| 479 | var allReports []scanner.ImportersReport |
| 480 | var shownReports []scanner.ImportersReport |
| 481 | var jsonReports []blastRadiusImporters |
| 482 | var rawImpacted []blastRadiusRelation |
| 483 | var impacted []blastRadiusRelation |
| 484 | var rawContext []blastRadiusRelation |
no test coverage detected