Skip to content

Commit e4ffe6f

Browse files
committed
Only specify queries for run-queries if both analysis kinds are enabled
1 parent cb8f28f commit e4ffe6f

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

lib/analyze-action.js

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/analyze.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,19 @@ export async function runQueries(
654654
try {
655655
const sarifFile = path.join(sarifFolder, `${language}.sarif`);
656656

657+
// This should be empty to run only the query suite that was generated when
658+
// the database was initialised.
657659
const queries: string[] = [];
658-
if (configUtils.isCodeQualityEnabled(config)) {
660+
661+
// If both Code Scanning and Code Quality analyses are enabled, the database
662+
// is initialised for Code Scanning. To avoid duplicate work, we want to run
663+
// queries for both analyses at the same time. To do this, we invoke `run-queries`
664+
// once with the generated query suite for Code Scanning + the fixed
665+
// query suite for Code Quality.
666+
if (
667+
configUtils.isCodeQualityEnabled(config) &&
668+
configUtils.isCodeScanningEnabled(config)
669+
) {
659670
queries.push(util.getGeneratedSuitePath(config, language));
660671
for (const qualityQuery of analyses.codeQualityQueries) {
661672
queries.push(resolveQuerySuiteAlias(language, qualityQuery));

0 commit comments

Comments
 (0)