@@ -703,44 +703,36 @@ export async function runQueries(
703703 statusReport [ `analyze_builtin_queries_${ language } _duration_ms` ] =
704704 new Date ( ) . getTime ( ) - startTimeRunQueries ;
705705
706- const startTimeInterpretResults = new Date ( ) ;
707-
708- // If only one analysis kind is enabled, then the database is initialised for the
709- // respective set of queries. Therefore, running `interpret-results` produces the
710- // SARIF file we want for the one enabled analysis kind.
711- let analysisSummary : string | undefined ;
712- if (
713- configUtils . isCodeScanningEnabled ( config ) ||
714- configUtils . isCodeQualityEnabled ( config )
715- ) {
716- logger . startGroup (
717- `Interpreting ${ dbAnalysisConfig . name } results for ${ language } ` ,
718- ) ;
719-
720- // If this is a Code Quality analysis, correct the category to one
721- // accepted by the Code Quality backend.
722- let category = automationDetailsId ;
723- if ( configUtils . isCodeQualityEnabled ( config ) ) {
724- category = fixCodeQualityCategory ( logger , automationDetailsId ) ;
725- }
706+ // There is always at least one analysis kind enabled. Running `interpret-results`
707+ // produces the SARIF file for the analysis kind that the database was initialised with.
708+ logger . startGroup (
709+ `Interpreting ${ dbAnalysisConfig . name } results for ${ language } ` ,
710+ ) ;
726711
727- analysisSummary = await runInterpretResults (
728- language ,
729- undefined ,
730- sarifFile ,
731- config . debugMode ,
732- category ,
733- ) ;
712+ // If this is a Code Quality analysis, correct the category to one
713+ // accepted by the Code Quality backend.
714+ let category = automationDetailsId ;
715+ if ( dbAnalysisConfig . kind === analyses . AnalysisKind . CodeQuality ) {
716+ category = fixCodeQualityCategory ( logger , automationDetailsId ) ;
734717 }
735718
736- // This case is only needed if Code Quality is enabled in addition to Code Scanning.
719+ const startTimeInterpretResults = new Date ( ) ;
720+ const analysisSummary = await runInterpretResults (
721+ language ,
722+ undefined ,
723+ sarifFile ,
724+ config . debugMode ,
725+ category ,
726+ ) ;
727+
728+ // This case is only needed if Code Quality is not the sole analysis kind.
737729 // In this case, we will have run queries for both analysis kinds. The previous call to
738730 // `interpret-results` will have produced a SARIF file for Code Scanning and we now
739731 // need to produce an additional SARIF file for Code Quality.
740732 let qualityAnalysisSummary : string | undefined ;
741733 if (
742- configUtils . isCodeQualityEnabled ( config ) &&
743- configUtils . isCodeScanningEnabled ( config )
734+ config . analysisKinds . length > 1 &&
735+ configUtils . isCodeQualityEnabled ( config )
744736 ) {
745737 logger . info (
746738 `Interpreting ${ analyses . CodeQuality . name } results for ${ language } ` ,
@@ -768,9 +760,7 @@ export async function runQueries(
768760 endTimeInterpretResults . getTime ( ) - startTimeInterpretResults . getTime ( ) ;
769761 logger . endGroup ( ) ;
770762
771- if ( analysisSummary ) {
772- logger . info ( analysisSummary ) ;
773- }
763+ logger . info ( analysisSummary ) ;
774764 if ( qualityAnalysisSummary ) {
775765 logger . info ( qualityAnalysisSummary ) ;
776766 }
0 commit comments