@@ -703,44 +703,36 @@ export async function runQueries(
703
703
statusReport [ `analyze_builtin_queries_${ language } _duration_ms` ] =
704
704
new Date ( ) . getTime ( ) - startTimeRunQueries ;
705
705
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
+ ) ;
726
711
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 ) ;
734
717
}
735
718
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.
737
729
// In this case, we will have run queries for both analysis kinds. The previous call to
738
730
// `interpret-results` will have produced a SARIF file for Code Scanning and we now
739
731
// need to produce an additional SARIF file for Code Quality.
740
732
let qualityAnalysisSummary : string | undefined ;
741
733
if (
742
- configUtils . isCodeQualityEnabled ( config ) &&
743
- configUtils . isCodeScanningEnabled ( config )
734
+ config . analysisKinds . length > 1 &&
735
+ configUtils . isCodeQualityEnabled ( config )
744
736
) {
745
737
logger . info (
746
738
`Interpreting ${ analyses . CodeQuality . name } results for ${ language } ` ,
@@ -768,9 +760,7 @@ export async function runQueries(
768
760
endTimeInterpretResults . getTime ( ) - startTimeInterpretResults . getTime ( ) ;
769
761
logger . endGroup ( ) ;
770
762
771
- if ( analysisSummary ) {
772
- logger . info ( analysisSummary ) ;
773
- }
763
+ logger . info ( analysisSummary ) ;
774
764
if ( qualityAnalysisSummary ) {
775
765
logger . info ( qualityAnalysisSummary ) ;
776
766
}
0 commit comments