Make code that builds the list of queries for run-queries more robust in the event of future changes

This commit is contained in:
Michael B. Gale
2025-09-04 12:03:24 +01:00
parent f4fca70590
commit ae2df70629
2 changed files with 15 additions and 14 deletions

View File

@@ -675,18 +675,17 @@ export async function runQueries(
// the database was initialised.
const queries: string[] = [];
// 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)
) {
// If multiple analysis kinds are enabled, the database is initialised for Code Scanning.
// To avoid duplicate work, we want to run queries for all analyses at the same time.
// To do this, we invoke `run-queries` once with the generated query suite that was created
// when the database was initialised + the queries for other analysis kinds.
if (config.analysisKinds.length > 1) {
queries.push(util.getGeneratedSuitePath(config, language));
for (const qualityQuery of analyses.codeQualityQueries) {
queries.push(resolveQuerySuiteAlias(language, qualityQuery));
if (configUtils.isCodeQualityEnabled(config)) {
for (const qualityQuery of analyses.codeQualityQueries) {
queries.push(resolveQuerySuiteAlias(language, qualityQuery));
}
}
}