Only specify queries for run-queries if both analysis kinds are enabled

This commit is contained in:
Michael B. Gale
2025-08-28 17:01:22 +01:00
parent cb8f28fbf7
commit e4ffe6f3e5
2 changed files with 16 additions and 2 deletions
+12 -1
View File
@@ -654,8 +654,19 @@ export async function runQueries(
try {
const sarifFile = path.join(sarifFolder, `${language}.sarif`);
// This should be empty to run only the query suite that was generated when
// the database was initialised.
const queries: string[] = [];
if (configUtils.isCodeQualityEnabled(config)) {
// If both Code Scanning and Code Quality analyses are enabled, the database
// is initialised for Code Scanning. To avoid duplicate work, we want to run
// queries for both analyses at the same time. To do this, we invoke `run-queries`
// once with the generated query suite for Code Scanning + the fixed
// query suite for Code Quality.
if (
configUtils.isCodeQualityEnabled(config) &&
configUtils.isCodeScanningEnabled(config)
) {
queries.push(util.getGeneratedSuitePath(config, language));
for (const qualityQuery of analyses.codeQualityQueries) {
queries.push(resolveQuerySuiteAlias(language, qualityQuery));