Wrap reading and writing SARIF files
This commit is contained in:
parent
fb32c3fefd
commit
1e7a38893c
6 changed files with 27 additions and 19 deletions
|
|
@ -923,11 +923,7 @@ export async function getCodeQLForCmd(
|
|||
);
|
||||
|
||||
if (shouldExportDiagnostics) {
|
||||
let sarif = JSON.parse(
|
||||
fs.readFileSync(codeqlOutputFile, "utf8")
|
||||
) as util.SarifFile;
|
||||
sarif = util.fixInvalidNotifications(sarif, logger);
|
||||
fs.writeFileSync(sarifFile, JSON.stringify(sarif));
|
||||
util.fixInvalidNotificationsInFile(codeqlOutputFile, sarifFile, logger);
|
||||
}
|
||||
|
||||
return returnState.stdout;
|
||||
|
|
@ -1050,11 +1046,11 @@ export async function getCodeQLForCmd(
|
|||
await new toolrunner.ToolRunner(cmd, args).exec();
|
||||
|
||||
// Fix invalid notifications in the SARIF file output by CodeQL.
|
||||
let sarif = JSON.parse(
|
||||
fs.readFileSync(intermediateSarifFile, "utf8")
|
||||
) as util.SarifFile;
|
||||
sarif = util.fixInvalidNotifications(sarif, logger);
|
||||
fs.writeFileSync(sarifFile, JSON.stringify(sarif));
|
||||
util.fixInvalidNotificationsInFile(
|
||||
intermediateSarifFile,
|
||||
sarifFile,
|
||||
logger
|
||||
);
|
||||
},
|
||||
async diagnosticsExport(
|
||||
sarifFile: string,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue