function combineSarifFiles(sarifFiles) {
    let combinedSarif = {
        version: null,
        runs: []
    };
    for (let sarifFile of sarifFiles) {
        if (fs.lstatSync(sarifFile).isDirectory()) {
            continue;
        }
        let sarifObject = JSON.parse(fs.readFileSync(sarifFile, 'utf8'));
        // Check SARIF version
        if (combinedSarif.version === null) {
            combinedSarif.version = sarifObject.version;
        }
        else if (combinedSarif.version !== sarifObject.version) {
            throw "Different SARIF versions encountered: " + combinedSarif.version + " and " + sarifObject.version;
        }
        combinedSarif.runs.push(...sarifObject.runs);
    }
    return JSON.stringify(combinedSarif);
}
// returning the contents of the combined sarif file.
returning the contents of the combined sarif file.
returning the contents of the combined sarif file .
function combineSarifFiles(sarifFiles) {
    let combinedSarif = {
        version: null,
        runs: []
    };
    for (let sarifFile of sarifFiles) {
        if (fs.lstatSync(sarifFile).isDirectory()) {
            continue;
        }
        let sarifObject = JSON.parse(fs.readFileSync(sarifFile, 'utf8'));
        if (combinedSarif.version === null) {
            combinedSarif.version = sarifObject.version;
        }
        else if (combinedSarif.version !== sarifObject.version) {
            throw "Different SARIF versions encountered: " + combinedSarif.version + " and " + sarifObject.version;
        }
        combinedSarif.runs.push(...sarifObject.runs);
    }
    return JSON.stringify(combinedSarif);
}
function combineSarifFiles ( sarifFiles ) { let combinedSarif = { version : null , runs : [ ] } ; for ( let sarifFile of sarifFiles ) { if ( fs . lstatSync ( sarifFile ) . isDirectory ( ) ) { continue ; } let sarifObject = JSON . parse ( fs . readFileSync ( sarifFile , 'utf8' ) ) ; if ( combinedSarif . version === null ) { combinedSarif . version = sarifObject . version ; } else if ( combinedSarif . version !== sarifObject . version ) { throw "Different SARIF versions encountered: " + combinedSarif . version + " and " + sarifObject . version ; } combinedSarif . runs . push ( ... sarifObject . runs ) ; } return JSON . stringify ( combinedSarif ) ; }
returning the contents of the combined sarif file.
returning the contents of the combined sarif file .
// Check SARIF version