@@ -29,6 +29,8 @@ import { spawn } from "child_process";
29
29
// a handle of autofixes for each query, this should be sufficient.
30
30
// Consider increasing this in the future if needed.
31
31
const MAX_NUM_REPOS : number = 3 ;
32
+ // Similarly, limit to three fixes per repo.
33
+ const MAX_NUM_FIXES : number = 3 ;
32
34
33
35
/**
34
36
* Generates autofixes for the results of a variant analysis.
@@ -490,6 +492,31 @@ async function runAutofixForRepository(
490
492
transcriptFilePath,
491
493
fixDescriptionFilePath,
492
494
} = await getRepoStoragePaths ( autofixOutputStoragePath , nwo ) ;
495
+
496
+ // Get autofix binary.
497
+ // Switch to Go binary in the future and have user pass full path
498
+ // in an environment variable instead of hardcoding part here.
499
+ const cocofixBin = join ( process . cwd ( ) , localAutofixPath , "bin" , "cocofix.js" ) ;
500
+
501
+ // Limit number of fixes generated.
502
+ const limitFixesBoolean : boolean = resultCount > MAX_NUM_FIXES ;
503
+ if ( limitFixesBoolean ) {
504
+ void Window . showInformationMessage (
505
+ `Only generating autofixes for the first ${ MAX_NUM_FIXES } alerts for ${ nwo } .` ,
506
+ ) ;
507
+
508
+ // Run autofix in a loop for the first MAX_NUM_FIXES alerts.
509
+ // Not an ideal solution, but avoids modifying the input SARIF file.
510
+ for ( let i = 0 ; i < MAX_NUM_FIXES ; i ++ ) {
511
+ // TODO: run autofix for the i-th alert.
512
+ }
513
+ } else {
514
+ // TODO: run autofix once for all alerts.
515
+ }
516
+
517
+ // Save output text files from each repo to later merge
518
+ // into a single markdown file containing all results.
519
+ outputTextFiles . push ( outputTextFilePath ) ;
493
520
}
494
521
495
522
/**
0 commit comments