@@ -8,7 +8,7 @@ import type {
88 VariantAnalysisRepositoryTask ,
99} from "./shared/variant-analysis" ;
1010import type { Credentials } from "../common/authentication" ;
11- import type { NotificationLogger } from "../common/logging" ;
11+ import { extLogger } from "../common/logging/vscode " ;
1212import type { App } from "../common/app" ;
1313import type { CodeQLCliServer } from "../codeql-cli/cli" ;
1414import {
@@ -26,7 +26,6 @@ import { withProgress, progressUpdate } from "../common/vscode/progress";
2626import type { ProgressCallback } from "../common/vscode/progress" ;
2727import { join , dirname , parse } from "path" ;
2828import { tryGetQueryMetadata } from "../codeql-cli/query-metadata" ;
29- import { window as Window } from "vscode" ;
3029import { pluralize } from "../common/word" ;
3130import { readRepoTask } from "./repo-tasks-store" ;
3231import { tmpdir } from "os" ;
@@ -55,7 +54,6 @@ export async function viewAutofixesForVariantAnalysisResults(
5554 variantAnalysisId : number ,
5655 filterSort : RepositoriesFilterSortStateWithIds = defaultFilterSortState ,
5756 credentials : Credentials ,
58- logger : NotificationLogger ,
5957 app : App ,
6058 cliServer : CodeQLCliServer ,
6159) : Promise < void > {
@@ -106,7 +104,6 @@ export async function viewAutofixesForVariantAnalysisResults(
106104 autofixOutputStoragePath ,
107105 localAutofixPath ,
108106 credentials ,
109- logger ,
110107 ) ;
111108
112109 // Output results from all repos to a combined markdown file.
@@ -235,11 +232,10 @@ function getSelectedRepositoryNames(
235232 throw new Error ( "No repositories with results found." ) ;
236233 }
237234
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.
240236 if ( fullNames . length > MAX_NUM_REPOS ) {
241237 fullNames = fullNames . slice ( 0 , MAX_NUM_REPOS ) ;
242- void Window . showInformationMessage (
238+ void extLogger . log (
243239 `Only the first ${ MAX_NUM_REPOS } repos (${ fullNames . join ( ", " ) } ) will be included in the Autofix results.` ,
244240 ) ;
245241 }
@@ -305,7 +301,6 @@ async function processSelectedRepositories(
305301 autofixOutputStoragePath : string ,
306302 localAutofixPath : string ,
307303 credentials : Credentials ,
308- logger : NotificationLogger ,
309304) : Promise < string [ ] > {
310305 const outputTextFiles : string [ ] = [ ] ;
311306 await Promise . all (
@@ -344,7 +339,6 @@ async function processSelectedRepositories(
344339 repoTask . databaseCommitSha ,
345340 sourceRootsStoragePath ,
346341 credentials ,
347- logger ,
348342 ) ;
349343
350344 // Run autofix.
@@ -356,7 +350,6 @@ async function processSelectedRepositories(
356350 localAutofixPath ,
357351 autofixOutputStoragePath ,
358352 repoTask . resultCount ,
359- logger ,
360353 outputTextFiles ,
361354 ) ;
362355 } ,
@@ -406,7 +399,6 @@ async function downloadPublicCommitSource(
406399 sha : string ,
407400 outputPath : string ,
408401 credentials : Credentials ,
409- logger : NotificationLogger ,
410402) : Promise < string > {
411403 const [ owner , repo ] = nwo . split ( "/" ) ;
412404 if ( ! owner || ! repo ) {
@@ -424,13 +416,13 @@ async function downloadPublicCommitSource(
424416
425417 // Check if directory already exists to avoid re-downloading
426418 if ( await pathExists ( checkoutDir ) ) {
427- void logger . log (
419+ void extLogger . log (
428420 `Source for ${ nwo } at ${ sha } already exists at ${ checkoutDir } .` ,
429421 ) ;
430422 return checkoutDir ;
431423 }
432424
433- void logger . log ( `Fetching source of repository ${ nwo } at ${ sha } ...` ) ;
425+ void extLogger . log ( `Fetching source of repository ${ nwo } at ${ sha } ...` ) ;
434426
435427 try {
436428 // Create a temporary directory for downloading
@@ -469,7 +461,7 @@ async function downloadPublicCommitSource(
469461 ) ;
470462 } ) ;
471463
472- void logger . log ( `Download complete, extracting source...` ) ;
464+ void extLogger . log ( `Download complete, extracting source...` ) ;
473465
474466 // Extract the tarball
475467 await new Promise < void > ( ( resolve , reject ) => {
@@ -523,7 +515,6 @@ async function runAutofixForRepository(
523515 localAutofixPath : string ,
524516 autofixOutputStoragePath : string ,
525517 resultCount : number ,
526- logger : NotificationLogger ,
527518 outputTextFiles : string [ ] ,
528519) : Promise < void > {
529520 // Get storage paths for the autofix results for this repository.
@@ -542,7 +533,7 @@ async function runAutofixForRepository(
542533 // Limit number of fixes generated.
543534 const limitFixesBoolean : boolean = resultCount > MAX_NUM_FIXES ;
544535 if ( limitFixesBoolean ) {
545- void Window . showInformationMessage (
536+ void extLogger . log (
546537 `Only generating autofixes for the first ${ MAX_NUM_FIXES } alerts for ${ nwo } .` ,
547538 ) ;
548539
@@ -570,7 +561,6 @@ async function runAutofixForRepository(
570561 transcriptFiles . push ( tempTranscriptFilePath ) ;
571562
572563 await runAutofixOnResults (
573- logger ,
574564 cocofixBin ,
575565 sarifFile ,
576566 srcRootPath ,
@@ -590,7 +580,6 @@ async function runAutofixForRepository(
590580 } else {
591581 // Run autofix once for all alerts.
592582 await runAutofixOnResults (
593- logger ,
594583 cocofixBin ,
595584 sarifFile ,
596585 srcRootPath ,
@@ -637,7 +626,6 @@ async function getRepoStoragePaths(
637626 * Runs autofix on the results in the given SARIF file.
638627 */
639628async function runAutofixOnResults (
640- logger : NotificationLogger ,
641629 cocofixBin : string ,
642630 sarifFile : string ,
643631 srcRootPath : string ,
@@ -680,7 +668,6 @@ async function runAutofixOnResults(
680668 }
681669
682670 await execAutofix (
683- logger ,
684671 cocofixBin ,
685672 autofixArgs ,
686673 {
@@ -698,7 +685,6 @@ async function runAutofixOnResults(
698685 * Executes the autofix command.
699686 */
700687function execAutofix (
701- logger : NotificationLogger ,
702688 bin : string ,
703689 args : string [ ] ,
704690 options : Parameters < typeof execFileSync > [ 2 ] ,
@@ -708,7 +694,7 @@ function execAutofix(
708694 try {
709695 const cwd = options ?. cwd || process . cwd ( ) ;
710696 if ( showCommand ) {
711- void logger . log ( `Spawning '${ bin } ${ args . join ( " " ) } ' in ${ cwd } ` ) ;
697+ void extLogger . log ( `Spawning '${ bin } ${ args . join ( " " ) } ' in ${ cwd } ` ) ;
712698 }
713699 const p = spawn ( bin , args , { stdio : [ 0 , 1 , 2 ] , ...options } ) ;
714700 p . on ( "error" , reject ) ;
0 commit comments