File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed
extensions/ql-vscode/src/variant-analysis Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -544,6 +544,59 @@ async function getRepoStoragePaths(
544
544
} ;
545
545
}
546
546
547
+ /**
548
+ * Runs autofix on the results in the given SARIF file.
549
+ */
550
+ async function runAutofixOnResults (
551
+ logger : NotificationLogger ,
552
+ cocofixBin : string ,
553
+ sarifFile : string ,
554
+ srcRootPath : string ,
555
+ outputTextFilePath : string ,
556
+ fixDescriptionFilePath : string ,
557
+ transcriptFilePath : string ,
558
+ workDir : string ,
559
+ alertNumber ?: number , // Optional parameter for specific alert
560
+ ) : Promise < void > {
561
+ // Set up args for autofix command.
562
+ const fixedAutofixArgs = [
563
+ "--sarif" ,
564
+ sarifFile ,
565
+ "--source-root" ,
566
+ srcRootPath ,
567
+ "--model" ,
568
+ "capi-dev-4o" , // may fail with older versions of cocofix
569
+ "--dev" ,
570
+ "--no-cache" ,
571
+ "--format" ,
572
+ "text" ,
573
+ "--diff-style" ,
574
+ "diff" , // could do "text" instead if want line of "=" between fixes
575
+ ] ;
576
+ const varAutofixArgs = createVarAutofixArgs (
577
+ outputTextFilePath ,
578
+ fixDescriptionFilePath ,
579
+ transcriptFilePath ,
580
+ alertNumber ,
581
+ ) ;
582
+
583
+ const autofixArgs = [ ...fixedAutofixArgs , ...varAutofixArgs ] ;
584
+
585
+ await execAutofix (
586
+ logger ,
587
+ cocofixBin ,
588
+ autofixArgs ,
589
+ {
590
+ cwd : workDir ,
591
+ env : {
592
+ CAPI_DEV_KEY : process . env . CAPI_DEV_KEY ,
593
+ PATH : process . env . PATH ,
594
+ } ,
595
+ } ,
596
+ true ,
597
+ ) ;
598
+ }
599
+
547
600
/**
548
601
* Creates autofix arguments that vary depending on the run.
549
602
*/
You can’t perform that action at this time.
0 commit comments