Add capability to filter queries
This change adds a `query-filters` property to the codeql-config file. This property is an array of `exclude`/`include` entries for a query suite. These filters are appended to the generated query suite files and used to filter queries after they are selected. A related change is that now, all pack references are run in a single query suite, which has the query filters appended to them.
This commit is contained in:
parent
bcb7fad5b3
commit
40b280032c
18 changed files with 637 additions and 101 deletions
|
|
@ -1572,6 +1572,60 @@ test(invalidPackNameMacro, "c/d@../a");
|
|||
test(invalidPackNameMacro, "c/d@b/../a");
|
||||
test(invalidPackNameMacro, "c/d:z@1");
|
||||
|
||||
/**
|
||||
* Test macro for pretty printing pack specs
|
||||
*/
|
||||
const packSpecPrettyPrintingMacro = test.macro({
|
||||
exec: (t: ExecutionContext, packStr: string, packObj: configUtils.Pack) => {
|
||||
const parsed = configUtils.parsePacksSpecification(packStr);
|
||||
t.deepEqual(parsed, packObj, "parsed pack spec is correct");
|
||||
const stringified = configUtils.prettyPrintPack(packObj);
|
||||
t.deepEqual(
|
||||
stringified,
|
||||
packStr.trim(),
|
||||
"pretty-printed pack spec is correct"
|
||||
);
|
||||
|
||||
t.deepEqual(
|
||||
configUtils.validatePackSpecification(packStr),
|
||||
packStr.trim(),
|
||||
"pack spec is valid"
|
||||
);
|
||||
},
|
||||
title: (
|
||||
_providedTitle: string | undefined,
|
||||
packStr: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
_packObj: configUtils.Pack
|
||||
) => `Prettyprint pack spec: '${packStr}'`,
|
||||
});
|
||||
|
||||
test(packSpecPrettyPrintingMacro, "a/b", {
|
||||
name: "a/b",
|
||||
version: undefined,
|
||||
path: undefined,
|
||||
});
|
||||
test(packSpecPrettyPrintingMacro, "a/b@~1.2.3", {
|
||||
name: "a/b",
|
||||
version: "~1.2.3",
|
||||
path: undefined,
|
||||
});
|
||||
test(packSpecPrettyPrintingMacro, "a/b@~1.2.3:abc/def", {
|
||||
name: "a/b",
|
||||
version: "~1.2.3",
|
||||
path: "abc/def",
|
||||
});
|
||||
test(packSpecPrettyPrintingMacro, "a/b:abc/def", {
|
||||
name: "a/b",
|
||||
version: undefined,
|
||||
path: "abc/def",
|
||||
});
|
||||
test(packSpecPrettyPrintingMacro, " a/b:abc/def ", {
|
||||
name: "a/b",
|
||||
version: undefined,
|
||||
path: "abc/def",
|
||||
});
|
||||
|
||||
/**
|
||||
* Test macro for testing the packs block and the packs input
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue