Always read BQRS results file (#2741)

This commit is contained in:
Shati Patel
2023-08-24 12:11:51 +01:00
committed by GitHub
parent 422f6de05e
commit 2ffb7894d4

View File

@@ -199,34 +199,35 @@ export class VariantAnalysisResultsManager extends DisposableObject {
); );
const sarifPath = join(resultsDirectory, "results.sarif"); const sarifPath = join(resultsDirectory, "results.sarif");
const bqrsPath = join(resultsDirectory, "results.bqrs"); const bqrsPath = join(resultsDirectory, "results.bqrs");
let interpretedResults: AnalysisAlert[] | undefined;
let rawResults: AnalysisRawResults | undefined;
if (await pathExists(sarifPath)) { if (await pathExists(sarifPath)) {
const interpretedResults = await this.readSarifResults( interpretedResults = await this.readSarifResults(
sarifPath, sarifPath,
fileLinkPrefix, fileLinkPrefix,
); );
return {
variantAnalysisId,
repositoryId: repoTask.repository.id,
interpretedResults,
};
} }
if (await pathExists(bqrsPath)) { if (await pathExists(bqrsPath)) {
const rawResults = await this.readBqrsResults( rawResults = await this.readBqrsResults(
bqrsPath, bqrsPath,
fileLinkPrefix, fileLinkPrefix,
repoTask.sourceLocationPrefix, repoTask.sourceLocationPrefix,
); );
return {
variantAnalysisId,
repositoryId: repoTask.repository.id,
rawResults,
};
} }
throw new Error("Missing results file"); if (!interpretedResults && !rawResults) {
throw new Error("Missing results file");
}
return {
variantAnalysisId,
repositoryId: repoTask.repository.id,
interpretedResults,
rawResults,
};
} }
public async isVariantAnalysisRepoDownloaded( public async isVariantAnalysisRepoDownloaded(