( args: CompareReportsArgs, )
| 520 | } |
| 521 | |
| 522 | export async function findNewIssues( |
| 523 | args: CompareReportsArgs, |
| 524 | ): Promise<SourceFileIssue[]> { |
| 525 | const { |
| 526 | base, |
| 527 | currReport, |
| 528 | prevReport, |
| 529 | config, |
| 530 | ctx, |
| 531 | env: { git }, |
| 532 | } = args; |
| 533 | |
| 534 | const diffFiles = persistedFilesFromConfig(config, { |
| 535 | directory: ctx.directory, |
| 536 | isDiff: true, |
| 537 | }); |
| 538 | |
| 539 | await git.fetch('origin', base.ref, ['--depth=1']); |
| 540 | const reportsDiff = await readFile(diffFiles.json, 'utf8'); |
| 541 | const changedFiles = await listChangedFiles( |
| 542 | { base: 'FETCH_HEAD', head: 'HEAD' }, |
| 543 | git, |
| 544 | ); |
| 545 | |
| 546 | const issues = filterRelevantIssues({ |
| 547 | currReport: JSON.parse(currReport.content) as Report, |
| 548 | prevReport: JSON.parse(prevReport.content) as Report, |
| 549 | reportsDiff: JSON.parse(reportsDiff) as ReportsDiff, |
| 550 | changedFiles, |
| 551 | }); |
| 552 | logDebug( |
| 553 | `Found ${issues.length} relevant issues for ${ |
| 554 | Object.keys(changedFiles).length |
| 555 | } changed files`, |
| 556 | ); |
| 557 | |
| 558 | return issues; |
| 559 | } |
| 560 | |
| 561 | function projectToName(project: ProjectConfig | null): string { |
| 562 | return project?.name ?? '-'; |
no test coverage detected