Skip to content

Commit 8917115

Browse files
Update test SARIF file, marked performance improvement
1 parent fe52f1e commit 8917115

1 file changed

Lines changed: 5 additions & 17 deletions

File tree

  • extensions/ql-vscode/src

extensions/ql-vscode/src/cli.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -676,13 +676,14 @@ 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';
679+
const fakeSarifPath = '/Users/marcjaramillo/MLH/jdk11-taintedpath-large-ungrouped.sarif';
680680
try {
681681
const p = parser();
682682
//TODO: see if there is a way to create a parser that will return the count of codeFlow
683683
// paths first and then parse the SARIF based on whether it exceeds a certain threshhold.
684684
// Also, see if it's possible to parse only the first 5 or so codeFlows right up front
685685
// rather than parsing everything and then getting rid of the paths we don't want.
686+
// Update 11-10-2021: with the new test file, everything works much better so this may not be necessary.
686687
const pipeline = chain([
687688
fs.createReadStream(fakeSarifPath),
688689
p,
@@ -694,31 +695,18 @@ export class CodeQLCliServer implements Disposable {
694695
return await new Promise((resolve) => {
695696
asm.on('done', (asm) => {
696697
const dummyTool : sarif.Tool = {driver: {name: ''}};
697-
// Counts number of paths for each result and totals them
698-
// so we can let the user know how many paths exist even
699-
// when there are too many to display
700-
const pathsTotal = asm.current.map((result: sarif.Result) => (
701-
result.codeFlows!.length
702-
)) as number[];
703-
704-
const sum = pathsTotal.reduce((prev: number, curr: number) => prev + curr, 0);
705-
706-
const filteredResults = asm.current.map((result: sarif.Result) => (
707-
Object.assign({}, result, {codeFlows: result.codeFlows!.slice(0,5)})
708-
));
709698

710699
const log : sarif.Log = {
711700
version: '2.1.0',
712701
runs: [
713702
{
714703
tool: dummyTool,
715-
results: filteredResults
704+
results: asm.current
716705
}
717706
]
718707
};
719-
console.log('Number of results: ', log.runs[0]!.results?.length);
720-
console.log('Total paths: ', sum);
721-
console.log(log);
708+
709+
console.log('Log completed');
722710
resolve(log);
723711
});
724712
});

0 commit comments

Comments
 (0)