Use options object instead of boolean for mergeResults

This commit is contained in:
Koen Vlaswinkel 2024-03-25 10:01:54 +01:00
parent e20c273295
commit 6ac57535de
6 changed files with 13 additions and 7 deletions

2
lib/codeql.js generated
View file

@ -665,7 +665,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
}).exec(); }).exec();
return JSON.parse(extractorPath); return JSON.parse(extractorPath);
}, },
async mergeResults(sarifFiles, outputFile, mergeRunsFromEqualCategory = false) { async mergeResults(sarifFiles, outputFile, { mergeRunsFromEqualCategory = false, }) {
const args = [ const args = [
"github", "github",
"merge-results", "merge-results",

File diff suppressed because one or more lines are too long

4
lib/upload-lib.js generated
View file

@ -119,7 +119,9 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
fs.mkdirSync(baseTempDir, { recursive: true }); fs.mkdirSync(baseTempDir, { recursive: true });
const outputDirectory = fs.mkdtempSync(path.resolve(baseTempDir, "output-")); const outputDirectory = fs.mkdtempSync(path.resolve(baseTempDir, "output-"));
const outputFile = path.resolve(outputDirectory, "combined-sarif.sarif"); const outputFile = path.resolve(outputDirectory, "combined-sarif.sarif");
await codeQL.mergeResults(sarifFiles, outputFile, true); await codeQL.mergeResults(sarifFiles, outputFile, {
mergeRunsFromEqualCategory: true,
});
return JSON.parse(fs.readFileSync(outputFile, "utf8")); return JSON.parse(fs.readFileSync(outputFile, "utf8"));
} }
// Populates the run.automationDetails.id field using the analysis_key and environment // Populates the run.automationDetails.id field using the analysis_key and environment

File diff suppressed because one or more lines are too long

View file

@ -201,7 +201,7 @@ export interface CodeQL {
mergeResults( mergeResults(
sarifFiles: string[], sarifFiles: string[],
outputFile: string, outputFile: string,
mergeRunsFromEqualCategory?: boolean, options: { mergeRunsFromEqualCategory?: boolean },
): Promise<void>; ): Promise<void>;
} }
@ -1093,7 +1093,9 @@ export async function getCodeQLForCmd(
async mergeResults( async mergeResults(
sarifFiles: string[], sarifFiles: string[],
outputFile: string, outputFile: string,
mergeRunsFromEqualCategory = false, {
mergeRunsFromEqualCategory = false,
}: { mergeRunsFromEqualCategory?: boolean },
): Promise<void> { ): Promise<void> {
const args = [ const args = [
"github", "github",

View file

@ -153,7 +153,9 @@ async function combineSarifFilesUsingCLI(
const outputFile = path.resolve(outputDirectory, "combined-sarif.sarif"); const outputFile = path.resolve(outputDirectory, "combined-sarif.sarif");
await codeQL.mergeResults(sarifFiles, outputFile, true); await codeQL.mergeResults(sarifFiles, outputFile, {
mergeRunsFromEqualCategory: true,
});
return JSON.parse(fs.readFileSync(outputFile, "utf8")) as SarifFile; return JSON.parse(fs.readFileSync(outputFile, "utf8")) as SarifFile;
} }