mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
restructure codeql docs
This commit is contained in:
@@ -85,11 +85,11 @@ The following properties are supported in ``qlpack.yml`` files.
|
||||
* - ``suites``
|
||||
- ``suites``
|
||||
- Optional
|
||||
- The path to a directory that contains the "well-known" query suites in the pack, defined relative to the pack directory. You can run "well-known" suites stored in this directory by specifying the pack name, without providing their full path. To use query suites stored in other directories in the pack, you must provide their full path. For more information about query suites, see ":doc:`Creating CodeQL query suites <../using-the-codeql-cli/creating-codeql-query-suites>`."
|
||||
- The path to a directory that contains the "well-known" query suites in the pack, defined relative to the pack directory. You can run "well-known" suites stored in this directory by specifying the pack name, without providing their full path. To use query suites stored in other directories in the pack, you must provide their full path. For more information about query suites, see ":doc:`Creating CodeQL query suites <creating-codeql-query-suites>`."
|
||||
* - ``extractor``
|
||||
- ``javascript``
|
||||
- All test packs
|
||||
- The CodeQL language extractor to use when the CLI creates a database from test files in the pack. For more information about testing queries, see ":doc:`Testing custom queries <../using-the-codeql-cli/testing-custom-queries>`."
|
||||
- The CodeQL language extractor to use when the CLI creates a database from test files in the pack. For more information about testing queries, see ":doc:`Testing custom queries <testing-custom-queries>`."
|
||||
* - ``tests``
|
||||
- ``.``
|
||||
- Optional for test packs
|
||||
@@ -124,7 +124,7 @@ and ``libraryPathDependencies`` properties. If the pack contains query suites, y
|
||||
use the ``suites`` property to define their location. Query suites defined
|
||||
here are called "well-known" suites, and can be used on the command line by referring to
|
||||
their name only, rather than their full path.
|
||||
For more information about query suites, see ":doc:`Creating CodeQL query suites <../using-the-codeql-cli/creating-codeql-query-suites>`."
|
||||
For more information about query suites, see ":doc:`Creating CodeQL query suites <creating-codeql-query-suites>`."
|
||||
|
||||
For example, a ``qlpack.yml`` file for a QL pack featuring custom C++ queries
|
||||
and libraries may contain:
|
||||
@@ -154,10 +154,10 @@ For custom QL packs containing test files, you also need to include an
|
||||
``extractor`` property so that the ``test run`` command knows how to create test
|
||||
databases. You may also wish to specify the ``tests`` property.
|
||||
|
||||
.. include:: ../../reusables/test-qlpack.rst
|
||||
.. include:: ../reusables/test-qlpack.rst
|
||||
|
||||
For more information about running tests, see ":doc:`Testing custom queries
|
||||
<../using-the-codeql-cli/testing-custom-queries>`."
|
||||
<testing-custom-queries>`."
|
||||
|
||||
.. _standard-ql-packs:
|
||||
|
||||
@@ -11,7 +11,7 @@ CodeQL analyses produce :ref:`interpreted results
|
||||
For information about writing queries to run with ``database analyze``, see
|
||||
":doc:`Using custom queries with the CodeQL CLI <using-custom-queries-with-the-codeql-cli>`."
|
||||
|
||||
.. include:: ../../reusables/advanced-query-execution.rst
|
||||
.. include:: ../reusables/advanced-query-execution.rst
|
||||
|
||||
Before starting an analysis you must:
|
||||
|
||||
@@ -55,7 +55,7 @@ You must specify:
|
||||
|
||||
You can also specify:
|
||||
|
||||
- .. include:: ../../reusables/threads-query-execution.rst
|
||||
- .. include:: ../reusables/threads-query-execution.rst
|
||||
|
||||
|
||||
.. pull-quote::
|
||||
@@ -149,7 +149,7 @@ recursively, so any queries contained in subfolders will also be executed.
|
||||
Important
|
||||
|
||||
You shouldn't specify the root of a :doc:`QL pack
|
||||
<../codeql-cli-reference/about-ql-packs>` when executing ``database analyze``
|
||||
<about-ql-packs>` when executing ``database analyze``
|
||||
as it contains some special queries that aren't designed to be used with
|
||||
the command. Rather, to run a wide range of useful queries, run one of the
|
||||
LGTM.com query suites.
|
||||
@@ -171,7 +171,7 @@ You can save analysis results in a number of different formats, including SARIF
|
||||
and CSV.
|
||||
|
||||
The SARIF format is designed to represent the output of a broad range of static
|
||||
analysis tools. For more information, see :doc:`SARIF output <../codeql-cli-reference/sarif-output>`.
|
||||
analysis tools. For more information, see :doc:`SARIF output <sarif-output>`.
|
||||
|
||||
If you choose to generate results in CSV format, then each line in the output file
|
||||
corresponds to an alert. Each line is a comma-separated list with the following information:
|
||||
@@ -35,7 +35,7 @@ You must specify:
|
||||
- ``--language``: the identifier for the language to create a database for.
|
||||
CodeQL supports creating databases for the following languages:
|
||||
|
||||
.. include:: ../../reusables/extractors.rst
|
||||
.. include:: ../reusables/extractors.rst
|
||||
|
||||
Other options may be specified depending on the location of your source file and
|
||||
the language you want to analyze:
|
||||
@@ -75,7 +75,7 @@ CodeQL. For each project on LGTM.com, you can download an archived CodeQL
|
||||
database corresponding to the most recently analyzed revision of the code. These
|
||||
databases can also be analyzed using the CodeQL CLI.
|
||||
|
||||
.. include:: ../../reusables/download-lgtm-database.rst
|
||||
.. include:: ../reusables/download-lgtm-database.rst
|
||||
|
||||
Before running an analysis, unzip the databases and try :doc:`upgrading <upgrading-codeql-databases>` the
|
||||
unzipped databases to ensure they are compatible with your local copy of the
|
||||
@@ -85,7 +85,7 @@ CodeQL queries and libraries.
|
||||
|
||||
Note
|
||||
|
||||
.. include:: ../../reusables/index-files-note.rst
|
||||
.. include:: ../reusables/index-files-note.rst
|
||||
|
||||
Creating databases for non-compiled languages
|
||||
---------------------------------------------
|
||||
@@ -19,7 +19,7 @@ suite definition have been executed, the result is a set of selected queries.
|
||||
.. note::
|
||||
|
||||
Any custom queries that you want to add to a query suite must be in a :doc:`QL
|
||||
pack <../codeql-cli-reference/about-ql-packs>` and contain the correct query metadata.
|
||||
pack <about-ql-packs>` and contain the correct query metadata.
|
||||
For more information, see
|
||||
":doc:`Using custom queries with the CodeQL CLI <using-custom-queries-with-the-codeql-cli>`."
|
||||
|
||||
@@ -254,7 +254,7 @@ without providing their full path. This gives you a simple way of specifying a
|
||||
set of queries, without needing to search inside QL packs and distributions.
|
||||
To declare a directory that contains "well-known" query suites, add the directory
|
||||
to the ``suites`` property in the ``qlpack.yml`` file at the root of your QL pack.
|
||||
For more information, see "`About QL packs <../codeql-cli-reference/qlpack-overview.html#qlpack-yml-properties>`__."
|
||||
For more information, see "`About QL packs <qlpack-overview.html#qlpack-yml-properties>`__."
|
||||
|
||||
Using query suites with CodeQL
|
||||
------------------------------
|
||||
@@ -6,7 +6,7 @@ Getting started with the CodeQL CLI
|
||||
To run CodeQL commands, you need to set up the CLI so that it can access
|
||||
the tools, queries, and libraries required to create and analyze databases.
|
||||
|
||||
.. include:: ../../reusables/license-note.rst
|
||||
.. include:: ../reusables/license-note.rst
|
||||
|
||||
.. _setting-up-cli:
|
||||
|
||||
@@ -115,7 +115,7 @@ repository should be ``$HOME/codeql-home/codeql-go``.
|
||||
Within these repositories, the queries and libraries are organized into QL
|
||||
packs. Along with the queries themselves, QL packs contain important metadata
|
||||
that tells the CodeQL CLI how to process the query files. For more information,
|
||||
see ":doc:`About QL packs <../codeql-cli-reference/about-ql-packs>`."
|
||||
see ":doc:`About QL packs <about-ql-packs>`."
|
||||
|
||||
.. pull-quote:: Important
|
||||
|
||||
@@ -10,12 +10,12 @@ CodeQL CLI
|
||||
|
||||
- :ref:`CodeQL CLI reference <codeql-cli-reference>`: Learn more about the files you can use when running CodeQL processes and the results format and exit codes that CodeQL generates.
|
||||
|
||||
- `CodeQL CLI manual <codeql-cli-manual>`__: Detailed information about all the commands available with the CodeQL CLI.
|
||||
- `CodeQL CLI manual <../codeql-cli-manual>`__: Detailed information about all the commands available with the CodeQL CLI.
|
||||
|
||||
.. toctree::
|
||||
:titlesonly:
|
||||
:hidden:
|
||||
|
||||
using-the-codeql-cli/index
|
||||
codeql-cli-reference/index
|
||||
using-the-codeql-cli
|
||||
codeql-cli-reference
|
||||
|
||||
|
||||
@@ -44,4 +44,4 @@ to the ``codeql-javascript`` QL pack::
|
||||
|
||||
AngularJS/DeadAngularJSEventListener.ql
|
||||
|
||||
For another example, see `Testing custom queries <../using-the-codeql-cli/test-queries.html#example>`__.
|
||||
For another example, see `Testing custom queries <test-queries.html#example>`__.
|
||||
@@ -44,7 +44,7 @@ file that defines:
|
||||
The ``libraryPathDependencies`` value specifies the CodeQL queries to test.
|
||||
The ``extractor`` defines which language the CLI will use
|
||||
to create test databases from the code files stored in this QL pack.
|
||||
For more information, see ":doc:`About QL packs <../codeql-cli-reference/about-ql-packs>`."
|
||||
For more information, see ":doc:`About QL packs <about-ql-packs>`."
|
||||
|
||||
You may find it useful to look at the way query tests are organized in the
|
||||
`CodeQL repository <https://github.com/github/codeql>`__.
|
||||
@@ -70,7 +70,7 @@ Then add the following files to the subdirectory before you run the test command
|
||||
The location is defined relative to the root of the QL pack that contains the
|
||||
query. Usually, this is a QL pack specified by the
|
||||
``libraryPathDependencies`` for the test pack.
|
||||
For more information, see ":doc:`Query reference files <../codeql-cli-reference/query-reference-files>`."
|
||||
For more information, see ":doc:`Query reference files <query-reference-files>`."
|
||||
|
||||
You don't need to add a query reference file if the query you want to
|
||||
test is stored in the test directory,
|
||||
@@ -127,7 +127,7 @@ The ``<test|dir>`` argument can be one or more of the following:
|
||||
|
||||
You can also specify:
|
||||
|
||||
- .. include:: ../../reusables/threads-query-execution.rst
|
||||
- .. include:: ../reusables/threads-query-execution.rst
|
||||
|
||||
For full details of all the options you can use when testing queries,
|
||||
see the `test run reference documentation <../codeql-cli-manual/test-run.html>`__.
|
||||
@@ -172,13 +172,13 @@ Prepare a query and test files
|
||||
libraryPathDependencies: codeql-java
|
||||
|
||||
For more information about QL packs, see ":doc:`About QL packs
|
||||
<../codeql-cli-reference/about-ql-packs>`."
|
||||
<about-ql-packs>`."
|
||||
|
||||
#. Create a QL pack for your Java tests by adding a ``qlpack.yml`` file
|
||||
with the following contents to ``custom-queries/java/tests``,
|
||||
updating ``libraryPathDependencies`` to match the name of your QL pack of custom queries:
|
||||
|
||||
.. include:: ../../reusables/test-qlpack.rst
|
||||
.. include:: ../reusables/test-qlpack.rst
|
||||
|
||||
#. Within the Java test pack, create a directory to contain the test files
|
||||
associated with ``EmptyThen.ql``.
|
||||
@@ -10,7 +10,7 @@ This topic is specifically about writing
|
||||
queries to use with the `database analyze <../codeql-cli-manual/database-analyze.html>`__
|
||||
command to produce :ref:`interpreted results <interpret-query-results>`.
|
||||
|
||||
.. include:: ../../reusables/advanced-query-execution.rst
|
||||
.. include:: ../reusables/advanced-query-execution.rst
|
||||
|
||||
Writing a valid query
|
||||
---------------------
|
||||
@@ -3,7 +3,7 @@
|
||||
Using the CodeQL CLI
|
||||
====================
|
||||
|
||||
.. include:: ../../reusables/codeql-cli-overview.rst
|
||||
.. include:: ../reusables/codeql-cli-overview.rst
|
||||
|
||||
See the following links to learn how to get set up and run CodeQL commands:
|
||||
|
||||
Reference in New Issue
Block a user