Use include instructions for suite file

This commit is contained in:
Koen Vlaswinkel
2024-03-12 11:44:30 +01:00
parent 0feef365d9
commit b71a536e00
2 changed files with 10 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
const SARIF_RESULTS_QUERY_KINDS = [ export const SARIF_RESULTS_QUERY_KINDS = [
"problem", "problem",
"alert", "alert",
"path-problem", "path-problem",

View File

@@ -8,6 +8,7 @@ import type { CodeQLCliServer } from "../codeql-cli/cli";
import type { QlPackDetails } from "./ql-pack-details"; import type { QlPackDetails } from "./ql-pack-details";
import { getQlPackFilePath } from "../common/ql"; import { getQlPackFilePath } from "../common/ql";
import type { SuiteInstruction } from "../packaging/suite-instruction"; import type { SuiteInstruction } from "../packaging/suite-instruction";
import { SARIF_RESULTS_QUERY_KINDS } from "../common/query-metadata";
export async function resolveCodeScanningQueryPack( export async function resolveCodeScanningQueryPack(
logger: BaseLogger, logger: BaseLogger,
@@ -34,10 +35,15 @@ export async function resolveCodeScanningQueryPack(
import: `codeql-suites/${language}-code-scanning.qls`, import: `codeql-suites/${language}-code-scanning.qls`,
from: `${downloadedPack.name}@${downloadedPack.version}`, from: `${downloadedPack.name}@${downloadedPack.version}`,
}, },
// Exclude any non-problem queries
{ {
exclude: { // This is necessary to ensure that the next import filter
kind: ["diagnostic", "metric"], // is applied correctly
exclude: {},
},
{
// Only include problem queries
include: {
kind: SARIF_RESULTS_QUERY_KINDS,
}, },
}, },
]; ];