Skip to content

Commit 1fceeed

Browse files
committed
address review comments
1 parent 47480ac commit 1fceeed

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

docs/codeql/codeql-cli/creating-codeql-databases.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ Creating CodeQL databases
55

66
Before you analyze your code using CodeQL, you need to create a CodeQL
77
database containing all the data required to run queries on your code.
8+
You can create CodeQL databases yourself using the CodeQL CLI,
9+
or download them from GitHub.com.
810

911
CodeQL analysis relies on extracting relational data from your code, and
1012
using it to build a :ref:`CodeQL database <codeql-database>`. CodeQL
1113
databases contain all of the important information about a codebase, which can
12-
be analyzed by executing CodeQL queries against it.
14+
be analyzed by executing CodeQL queries against it. GitHub creates and
15+
stores CodeQL databases for a large number of open-source projects. For more information,
16+
see ":ref:`Downloading CodeQL databases from GitHub.com <downloading-codeql-databases-from-github-com>`."
17+
18+
You can also create CodeQL databases yourself using the CodeQL CLI.
1319
Before you generate a CodeQL database, you need to:
1420

1521
- Install and set up the CodeQL CLI. For more information, see
@@ -379,6 +385,8 @@ The following example shows how you could use indirect build tracing in an Azure
379385
# `codeql database analyze`
380386
# then `codeql github upload-results` ...
381387

388+
.. _downloading-databases-from-github-com:
389+
382390
Downloading databases from GitHub.com
383391
-------------------------------------
384392

docs/codeql/codeql-for-visual-studio-code/analyzing-your-projects.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ To analyze a project, you need to add a :ref:`CodeQL database <codeql-database>`
1414

1515
#. Open the CodeQL Databases view in the sidebar.
1616

17-
#. Hover over the **Databases** title bar and click the appropriate icon to add your database. You can add a database from a local ZIP archive or folder, from a public URL, or from a project slug on GitHub.com.
17+
#. Hover over the **Databases** title bar and click the appropriate icon to add your database. You can add a database from a local ZIP archive or folder, from a public URL, or from a project's URL on GitHub.com.
1818

1919
.. image:: ../images/codeql-for-visual-studio-code/choose-database.png
2020
:width: 350
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
GitHub stores CodeQL databases for over 200,000 repos on GitHub.com, which you can download using the REST API. The list of repos is constantly growing and evolving to make sure that it includes the most interesting codebases for security research.
22

3-
To download a database from GitHub.com using the `GitHub CLI <https://cli.github.com/manual/gh_api>`__, use the following command::
3+
You can check if a repo has any CodeQL databases available to download using the `/repos/<owner>/<repo>/code-scanning/codeql/databases` endpoint.
4+
For example, to check for CodeQL databases using the `GitHub CLI <https://cli.github.com/manual/gh_api>`__ you would run::
5+
6+
gh api /repos/<owner>/<repo>/code-scanning/codeql/databases/
7+
8+
This command will return information about the CodeQL databases that are available for a repository, including the language the database represents, and when the database was last updated. If no CodeQL databases are available, the response will be empty.
9+
10+
When you have confirmed that a CodeQL database exists for the language you are interested in, you can download it using the following command::
411

512
gh api /repos/<owner>/<repo>/code-scanning/codeql/databases/<language> -H 'Accept: application/zip' > path/to/local/database.zip
13+
14+
TODO: add link to the REST API docs.

0 commit comments

Comments
 (0)