You can create query suites for the queries that you want to frequently use in your CodeQL analyses. For more information, see CodeQL query suites.
Note
Any custom queries that you want to add to a query suite must be in a CodeQL pack and contain the correct query metadata. For more information, see Writing custom queries for the CodeQL CLI.
Locating queries to add to a query suite
When creating a query suite, you first need to specify the locations of the queries that you want to select. You can define the location of one or more queries using:
-
A
queryinstruction: Tells CodeQL to look for one or more specified.qlfiles:- query: <path-to-query>The argument must be one or more file paths, relative to the CodeQL pack containing the suite definition.
-
A
queriesinstruction: Tells CodeQL to recursively scan a directory for.qlfiles:- queries: <path-to-subdirectory>The path of the directory must be relative to the root of the CodeQL pack that contains the suite definition file. To find the queries relative to a different CodeQL pack, add a
fromfield:- queries: <path-to-subdirectory> from: <ql-pack-name> version: ^x.y.zThe
versionfield is optional and specifies a range of compatible versions of this CodeQL pack. If you don’t specify a version, then the most recent version of the pack is used.