Skip to content

Commit 4c74709

Browse files
authored
Merge pull request github#6606 from github/aeisenberg/docs
Update the docs about qlpacks
2 parents 13c4b93 + fb90bb4 commit 4c74709

File tree

1 file changed

+54
-23
lines changed

1 file changed

+54
-23
lines changed

docs/codeql/codeql-cli/about-ql-packs.rst

Lines changed: 54 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ The following properties are supported in ``qlpack.yml`` files.
8181
- All packs
8282
- A version number for this QL pack. This must be a valid semantic version that meets the `SemVer v2.0.0 specification <https://semver.org/spec/v2.0.0.html>`__.
8383
* - ``libraryPathDependencies``
84-
- ``codeql-javascript``
84+
- ``codeql/javascript-all``
8585
- Optional
8686
- The names of any QL packs that this QL pack depends on, as a sequence. This gives the pack access to any libraries, database schema, and query suites defined in the dependency.
8787
* - ``suites``
@@ -104,7 +104,18 @@ The following properties are supported in ``qlpack.yml`` files.
104104
- ``.``
105105
- Packs with upgrades
106106
- The path to a directory within the pack that contains upgrade scripts, defined relative to the pack directory. The ``database upgrade`` action uses these scripts to update databases that were created by an older version of an extractor so they're compatible with the current extractor (see `Upgrade scripts for a language <#upgrade-scripts-for-a-language>`__ below.)
107+
* - ``dependencies``
108+
- .. code-block:: yaml
107109

110+
dependencies:
111+
codeql/cpp-all: ^0.0.2
112+
113+
- Packs that define CodeQL package dependencies on other packs
114+
- A map from pack references to the semantic version range that is compatible with this pack. Supported from CLI version v2.6.0 and onwards.
115+
* - ``defaultSuiteFile``
116+
- ``defaultSuiteFile: cpp-code-scanning.qls``
117+
- Packs that export a set of default queries to run
118+
- The path to a query suite file containing all of the queries that are run by default when this pack is passed to the ``codeql database analyze`` command. Supported from CLI version v2.6.0 and onwards.
108119

109120
.. _custom-ql-packs:
110121

@@ -138,7 +149,7 @@ and libraries may contain:
138149
libraryPathDependencies: codeql/cpp-all
139150
suites: my-custom-suites
140151
141-
where ``codeql-cpp`` is the name of the QL pack for C/C++ analysis included in
152+
where ``codeql/cpp-all`` is the name of the QL pack for C/C++ analysis included in
142153
the CodeQL repository.
143154

144155
.. pull-quote::
@@ -166,54 +177,74 @@ For more information about running tests, see ":doc:`Testing custom queries
166177
Examples of QL packs in the CodeQL repository
167178
---------------------------------------------
168179

169-
Each of the languages in the CodeQL repository has three main QL packs:
180+
Each of the languages in the CodeQL repository has four main QL packs:
170181

171-
- Core QL pack for the language, with the :ref:`database schema <codeql-database-schema>`
172-
used by the language, CodeQL libraries, and queries at ``ql/<language>/ql/src``
173-
- Tests for the core language libraries and queries pack at ``ql/<language>/ql/test``
182+
- Core library pack for the language, with the :ref:`database schema <codeql-database-schema>`
183+
used by the language, and CodeQL libraries, and queries at ``ql/<language>/ql/lib``
184+
- Core query pack for the language that includes the default queries for the language, along
185+
with their query suites at ``ql/<language>/ql/src``
186+
- Tests for the core language libraries and queries at ``ql/<language>/ql/test``
174187
- Upgrade scripts for the language at ``ql/<language>/upgrades``
175188

176-
Core QL pack
177-
~~~~~~~~~~~~
189+
Core library pack
190+
~~~~~~~~~~~~~~~~~
178191

179-
The ``qlpack.yml`` file for a core QL pack uses the following properties:
180-
``name``, ``version``, ``dbscheme``, and ``suites``.
192+
The ``qlpack.yml`` file for a core library pack uses the following properties:
193+
``name``, ``version``, ``dbscheme``.
181194
The ``dbscheme`` property should only be defined in the core QL
182195
pack for a language.
183196

184-
For example, the ``qlpack.yml`` file for `C/C++ analysis
185-
<https://github.com/github/codeql/blob/main/cpp/ql/src/qlpack.yml>`__
197+
For example, the ``qlpack.yml`` file for `C/C++ analysis libraries
198+
<https://github.com/github/codeql/blob/main/cpp/ql/lib/qlpack.yml>`__
186199
contains:
187200

188201
.. code-block:: yaml
189202
190-
name: codeql-cpp
203+
name: codeql/cpp-all
191204
version: 0.0.0
192205
dbscheme: semmlecode.cpp.dbscheme
206+
dependencies:
207+
codeql/cpp-upgrades: "*"
208+
209+
Core query pack
210+
~~~~~~~~~~~~~~~
211+
212+
The ``qlpack.yml`` file for a core query pack uses the following properties:
213+
``name``, ``version``, ``suites``, ``defaultSuiteFile``, ``dependencies`` .
214+
215+
For example, the ``qlpack.yml`` file for `C/C++ analysis queries
216+
<https://github.com/github/codeql/blob/main/cpp/ql/lib/qlpack.yml>`__
217+
contains:
218+
219+
.. code-block:: yaml
220+
221+
name: codeql/cpp-queries
222+
version: 0.0.0
193223
suites: codeql-suites
224+
defaultSuiteFile: codeql-suites/cpp-code-scanning.qls
225+
dependencies:
226+
codeql/cpp-all: "*"
227+
codeql/suite-helpers: "*"
194228
195229
Tests for the core QL pack
196230
~~~~~~~~~~~~~~~~~~~~~~~~~~
197231

198232
The ``qlpack.yml`` file for the tests for the core QL packs use the following
199-
properties: ``name``, ``version``, and ``libraryPathDependencies``.
200-
The ``libraryPathDependencies`` always specifies the core QL pack.
233+
properties: ``name``, ``version``, and ``dependencies``.
234+
The ``dependencies`` always specifies the core QL pack.
201235

202236
For example, the ``qlpack.yml`` file for `C/C++ analysis tests
203237
<https://github.com/github/codeql/blob/main/cpp/ql/test/qlpack.yml>`__
204238
contains:
205239

206240
.. code-block:: yaml
207241
208-
name: codeql-cpp-tests
242+
name: codeql/cpp-tests
209243
version: 0.0.0
210-
libraryPathDependencies: codeql/cpp-all
244+
dependencies:
245+
codeql/cpp-all: "*"
246+
codeql/cpp-queries: "*"
211247
212-
Notice that, unlike the example QL pack for custom tests, this file does not define
213-
an ``extractor`` or ``tests`` property. These properties have been added to
214-
the QL pack file since the release of CodeQL CLI 2.0.1.
215-
They haven't been added yet to ensure compatibility for LGTM Enterprise users.
216-
After the next release of LGTM Enterprise, these files can be updated.
217248
218249
.. _upgrade-ql-packs:
219250

@@ -229,5 +260,5 @@ contains:
229260

230261
.. code-block:: yaml
231262
232-
name: codeql-cpp-upgrades
263+
name: codeql/cpp-upgrades
233264
upgrades: .

0 commit comments

Comments
 (0)