Skip to content

Commit 688ca1f

Browse files
Continue testing large
SARIF files
1 parent cfcfafe commit 688ca1f

1 file changed

Lines changed: 23 additions & 8 deletions

File tree

  • extensions/ql-vscode/src

extensions/ql-vscode/src/cli.ts

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -676,16 +676,29 @@ export class CodeQLCliServer implements Disposable {
676676

677677
async interpretBqrs(metadata: QueryMetadata, resultsPath: string, interpretedResultsPath: string, sourceInfo?: SourceInfo): Promise<sarif.Log> {
678678
await this.runInterpretCommand(SARIF_FORMAT, metadata, resultsPath, interpretedResultsPath, sourceInfo);
679+
const fakeSarifPath = '/Users/marcjaramillo/MLH/jdk11-tainted-path.sarif';
679680
try {
681+
const p = parser();
682+
console.log('Created parser');
683+
const pipeline = chain([
684+
fs.createReadStream(fakeSarifPath),
685+
p,
686+
pick({filter: 'runs.0.results'})
687+
]);
688+
console.log('Created pipeline');
689+
const asm = Assembler.connectTo(pipeline);
690+
console.log('Created assembler');
691+
let chunkCount = 0;
680692
//TODO: figure out error handling for Assembler
681693
return await new Promise((resolve) => {
682-
const pipeline = chain([
683-
fs.createReadStream(interpretedResultsPath),
684-
parser(),
685-
pick({filter: 'runs.0.results'})
686-
]);
687-
688-
const asm = Assembler.connectTo(pipeline);
694+
p.on('data', (_) => {
695+
chunkCount++;
696+
if(chunkCount % 10000000 === 0) {
697+
console.log('Chunks processed:', chunkCount);
698+
}
699+
});
700+
console.log('Created parser counter');
701+
689702
asm.on('done', (asm) => {
690703
const dummyTool : sarif.Tool = {driver: {name: ''}};
691704
const log : sarif.Log = {
@@ -697,9 +710,11 @@ export class CodeQLCliServer implements Disposable {
697710
}
698711
]
699712
};
700-
console.log(log);
713+
console.log('Number of results:', log.runs[0]!.results?.length);
714+
console.log(log.runs[0]!.results![0]);
701715
resolve(log);
702716
});
717+
console.log('Created assembler done listener');
703718
});
704719
} catch (err) {
705720
throw new Error(`Parsing output of interpretation failed: ${err.stderr || err}`);

0 commit comments

Comments
 (0)