Skip to content

Commit ae2df70

Browse files
committed
Make code that builds the list of queries for run-queries more robust in the event of future changes
1 parent f4fca70 commit ae2df70

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

lib/analyze-action.js

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/analyze.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -675,18 +675,17 @@ export async function runQueries(
675675
// the database was initialised.
676676
const queries: string[] = [];
677677

678-
// If both Code Scanning and Code Quality analyses are enabled, the database
679-
// is initialised for Code Scanning. To avoid duplicate work, we want to run
680-
// queries for both analyses at the same time. To do this, we invoke `run-queries`
681-
// once with the generated query suite for Code Scanning + the fixed
682-
// query suite for Code Quality.
683-
if (
684-
configUtils.isCodeQualityEnabled(config) &&
685-
configUtils.isCodeScanningEnabled(config)
686-
) {
678+
// If multiple analysis kinds are enabled, the database is initialised for Code Scanning.
679+
// To avoid duplicate work, we want to run queries for all analyses at the same time.
680+
// To do this, we invoke `run-queries` once with the generated query suite that was created
681+
// when the database was initialised + the queries for other analysis kinds.
682+
if (config.analysisKinds.length > 1) {
687683
queries.push(util.getGeneratedSuitePath(config, language));
688-
for (const qualityQuery of analyses.codeQualityQueries) {
689-
queries.push(resolveQuerySuiteAlias(language, qualityQuery));
684+
685+
if (configUtils.isCodeQualityEnabled(config)) {
686+
for (const qualityQuery of analyses.codeQualityQueries) {
687+
queries.push(resolveQuerySuiteAlias(language, qualityQuery));
688+
}
690689
}
691690
}
692691

0 commit comments

Comments
 (0)