@@ -8,7 +8,7 @@ import type {
8
8
VariantAnalysisRepositoryTask ,
9
9
} from "./shared/variant-analysis" ;
10
10
import type { Credentials } from "../common/authentication" ;
11
- import type { NotificationLogger } from "../common/logging" ;
11
+ import { extLogger } from "../common/logging/vscode " ;
12
12
import type { App } from "../common/app" ;
13
13
import type { CodeQLCliServer } from "../codeql-cli/cli" ;
14
14
import {
@@ -26,7 +26,6 @@ import { withProgress, progressUpdate } from "../common/vscode/progress";
26
26
import type { ProgressCallback } from "../common/vscode/progress" ;
27
27
import { join , dirname , parse } from "path" ;
28
28
import { tryGetQueryMetadata } from "../codeql-cli/query-metadata" ;
29
- import { window as Window } from "vscode" ;
30
29
import { pluralize } from "../common/word" ;
31
30
import { readRepoTask } from "./repo-tasks-store" ;
32
31
import { tmpdir } from "os" ;
@@ -55,7 +54,6 @@ export async function viewAutofixesForVariantAnalysisResults(
55
54
variantAnalysisId : number ,
56
55
filterSort : RepositoriesFilterSortStateWithIds = defaultFilterSortState ,
57
56
credentials : Credentials ,
58
- logger : NotificationLogger ,
59
57
app : App ,
60
58
cliServer : CodeQLCliServer ,
61
59
) : Promise < void > {
@@ -106,7 +104,6 @@ export async function viewAutofixesForVariantAnalysisResults(
106
104
autofixOutputStoragePath ,
107
105
localAutofixPath ,
108
106
credentials ,
109
- logger ,
110
107
) ;
111
108
112
109
// Output results from all repos to a combined markdown file.
@@ -235,11 +232,10 @@ function getSelectedRepositoryNames(
235
232
throw new Error ( "No repositories with results found." ) ;
236
233
}
237
234
238
- // Limit to MAX_NUM_REPOS by slicing the array,
239
- // and inform the user about the limit.
235
+ // Limit to MAX_NUM_REPOS by slicing the array.
240
236
if ( fullNames . length > MAX_NUM_REPOS ) {
241
237
fullNames = fullNames . slice ( 0 , MAX_NUM_REPOS ) ;
242
- void Window . showInformationMessage (
238
+ void extLogger . log (
243
239
`Only the first ${ MAX_NUM_REPOS } repos (${ fullNames . join ( ", " ) } ) will be included in the Autofix results.` ,
244
240
) ;
245
241
}
@@ -305,7 +301,6 @@ async function processSelectedRepositories(
305
301
autofixOutputStoragePath : string ,
306
302
localAutofixPath : string ,
307
303
credentials : Credentials ,
308
- logger : NotificationLogger ,
309
304
) : Promise < string [ ] > {
310
305
const outputTextFiles : string [ ] = [ ] ;
311
306
await Promise . all (
@@ -344,7 +339,6 @@ async function processSelectedRepositories(
344
339
repoTask . databaseCommitSha ,
345
340
sourceRootsStoragePath ,
346
341
credentials ,
347
- logger ,
348
342
) ;
349
343
350
344
// Run autofix.
@@ -356,7 +350,6 @@ async function processSelectedRepositories(
356
350
localAutofixPath ,
357
351
autofixOutputStoragePath ,
358
352
repoTask . resultCount ,
359
- logger ,
360
353
outputTextFiles ,
361
354
) ;
362
355
} ,
@@ -406,7 +399,6 @@ async function downloadPublicCommitSource(
406
399
sha : string ,
407
400
outputPath : string ,
408
401
credentials : Credentials ,
409
- logger : NotificationLogger ,
410
402
) : Promise < string > {
411
403
const [ owner , repo ] = nwo . split ( "/" ) ;
412
404
if ( ! owner || ! repo ) {
@@ -424,13 +416,13 @@ async function downloadPublicCommitSource(
424
416
425
417
// Check if directory already exists to avoid re-downloading
426
418
if ( await pathExists ( checkoutDir ) ) {
427
- void logger . log (
419
+ void extLogger . log (
428
420
`Source for ${ nwo } at ${ sha } already exists at ${ checkoutDir } .` ,
429
421
) ;
430
422
return checkoutDir ;
431
423
}
432
424
433
- void logger . log ( `Fetching source of repository ${ nwo } at ${ sha } ...` ) ;
425
+ void extLogger . log ( `Fetching source of repository ${ nwo } at ${ sha } ...` ) ;
434
426
435
427
try {
436
428
// Create a temporary directory for downloading
@@ -469,7 +461,7 @@ async function downloadPublicCommitSource(
469
461
) ;
470
462
} ) ;
471
463
472
- void logger . log ( `Download complete, extracting source...` ) ;
464
+ void extLogger . log ( `Download complete, extracting source...` ) ;
473
465
474
466
// Extract the tarball
475
467
await new Promise < void > ( ( resolve , reject ) => {
@@ -523,7 +515,6 @@ async function runAutofixForRepository(
523
515
localAutofixPath : string ,
524
516
autofixOutputStoragePath : string ,
525
517
resultCount : number ,
526
- logger : NotificationLogger ,
527
518
outputTextFiles : string [ ] ,
528
519
) : Promise < void > {
529
520
// Get storage paths for the autofix results for this repository.
@@ -542,7 +533,7 @@ async function runAutofixForRepository(
542
533
// Limit number of fixes generated.
543
534
const limitFixesBoolean : boolean = resultCount > MAX_NUM_FIXES ;
544
535
if ( limitFixesBoolean ) {
545
- void Window . showInformationMessage (
536
+ void extLogger . log (
546
537
`Only generating autofixes for the first ${ MAX_NUM_FIXES } alerts for ${ nwo } .` ,
547
538
) ;
548
539
@@ -570,7 +561,6 @@ async function runAutofixForRepository(
570
561
transcriptFiles . push ( tempTranscriptFilePath ) ;
571
562
572
563
await runAutofixOnResults (
573
- logger ,
574
564
cocofixBin ,
575
565
sarifFile ,
576
566
srcRootPath ,
@@ -590,7 +580,6 @@ async function runAutofixForRepository(
590
580
} else {
591
581
// Run autofix once for all alerts.
592
582
await runAutofixOnResults (
593
- logger ,
594
583
cocofixBin ,
595
584
sarifFile ,
596
585
srcRootPath ,
@@ -637,7 +626,6 @@ async function getRepoStoragePaths(
637
626
* Runs autofix on the results in the given SARIF file.
638
627
*/
639
628
async function runAutofixOnResults (
640
- logger : NotificationLogger ,
641
629
cocofixBin : string ,
642
630
sarifFile : string ,
643
631
srcRootPath : string ,
@@ -680,7 +668,6 @@ async function runAutofixOnResults(
680
668
}
681
669
682
670
await execAutofix (
683
- logger ,
684
671
cocofixBin ,
685
672
autofixArgs ,
686
673
{
@@ -698,7 +685,6 @@ async function runAutofixOnResults(
698
685
* Executes the autofix command.
699
686
*/
700
687
function execAutofix (
701
- logger : NotificationLogger ,
702
688
bin : string ,
703
689
args : string [ ] ,
704
690
options : Parameters < typeof execFileSync > [ 2 ] ,
@@ -708,7 +694,7 @@ function execAutofix(
708
694
try {
709
695
const cwd = options ?. cwd || process . cwd ( ) ;
710
696
if ( showCommand ) {
711
- void logger . log ( `Spawning '${ bin } ${ args . join ( " " ) } ' in ${ cwd } ` ) ;
697
+ void extLogger . log ( `Spawning '${ bin } ${ args . join ( " " ) } ' in ${ cwd } ` ) ;
712
698
}
713
699
const p = spawn ( bin , args , { stdio : [ 0 , 1 , 2 ] , ...options } ) ;
714
700
p . on ( "error" , reject ) ;
0 commit comments