You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/codeql/codeql-cli/analyzing-databases-with-the-codeql-cli.rst
+42-1Lines changed: 42 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -135,6 +135,47 @@ pack names and use the ``--download`` flag::
135
135
The ``analyze`` command above runs the default suite from ``microsoft/coding-standards v1.0.0`` and the latest version of ``github/security-queries`` on the specified database.
136
136
For further information about default suites, see ":ref:`Publishing and using CodeQL packs <publishing-and-using-codeql-packs>`".
137
137
138
+
Running a subset of queries in a CodeQL pack
139
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140
+
141
+
If you are using CodeQL CLI v2.8.1 or later, you can include a path at the end of a pack specification to run a subset of queries inside the pack. This applies to any command that locates or runs queries within a pack.
142
+
143
+
The complete way to specify a set of queries is in the form ``scope/name@range:path``, where:
144
+
145
+
- ``scope/name`` is the qualified name of a CodeQL pack.
146
+
- ``range`` is a `semver range <https://docs.npmjs.com/cli/v6/using-npm/semver#ranges>`_.
147
+
- ``path`` is a file system path to a single query, a directory containing queries, or a query suite file.
148
+
149
+
When you specify a ``scope/name``, the ``range`` and ``path`` are
150
+
optional. If you omit a ``range`` then the latest version of the
151
+
specified pack is used. If you omit a ``path`` then the default query suite
152
+
of the specified pack is used.
153
+
154
+
The ``path`` can be one of a ``*.ql`` query file, a directory
155
+
containing one or more queries, or a ``.qls`` query suite file. If
156
+
you omit a pack name, then you must provide a ``path``,
157
+
which will be interpreted relative to the working directory
158
+
of the current process.
159
+
160
+
If you specify a ``scope/name`` and ``path``, then the ``path`` cannot
161
+
be absolute. It is considered relative to the root of the CodeQL
162
+
pack.
163
+
164
+
To analyze a database using all queries in the `experimental/Security` folder within the `codeql/cpp-queries` CodeQL pack you can use::
To analyze your database using the `cpp-security-and-quality.qls` query suite from a version of the `codeql/cpp-queries` CodeQL pack that is >= 0.0.3 and < 0.1.0 (the highest compatible version will be chosen) you can use::
For more information about CodeQL packs, see :doc:`About CodeQL Packs <about-codeql-packs>`.
139
180
140
181
Running query suites
@@ -223,7 +264,7 @@ you can include the query help for your custom queries in SARIF files generated
223
264
After uploading the SARIF file to GitHub, the query help is shown in the code scanning UI for any
224
265
alerts generated by the custom queries.
225
266
226
-
From CodeQL CLI 2.7.1 onwards, you can include markdown-rendered query help in SARIF files
267
+
From CodeQL CLI v2.7.1 onwards, you can include markdown-rendered query help in SARIF files
227
268
by providing the ``--sarif-add-query-help`` option when running
228
269
``codeql database analyze``.
229
270
For more information, see `Configuring CodeQL CLI in your CI system <https://docs.github.com/en/code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/configuring-codeql-cli-in-your-ci-system#analyzing-a-codeql-database>`__
0 commit comments