Wrap reading and writing SARIF files
This commit is contained in:
parent
fb32c3fefd
commit
1e7a38893c
6 changed files with 27 additions and 19 deletions
8
lib/codeql.js
generated
8
lib/codeql.js
generated
|
|
@ -544,9 +544,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||
// capture stdout, which contains analysis summaries
|
||||
const returnState = await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, codeqlArgs, error_matcher_1.errorMatchers);
|
||||
if (shouldExportDiagnostics) {
|
||||
let sarif = JSON.parse(fs.readFileSync(codeqlOutputFile, "utf8"));
|
||||
sarif = util.fixInvalidNotifications(sarif, logger);
|
||||
fs.writeFileSync(sarifFile, JSON.stringify(sarif));
|
||||
util.fixInvalidNotificationsInFile(codeqlOutputFile, sarifFile, logger);
|
||||
}
|
||||
return returnState.stdout;
|
||||
},
|
||||
|
|
@ -642,9 +640,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||
}
|
||||
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"));
|
||||
sarif = util.fixInvalidNotifications(sarif, logger);
|
||||
fs.writeFileSync(sarifFile, JSON.stringify(sarif));
|
||||
util.fixInvalidNotificationsInFile(intermediateSarifFile, sarifFile, logger);
|
||||
},
|
||||
async diagnosticsExport(sarifFile, automationDetailsId, config, features) {
|
||||
const args = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue