Skip to content

Commit 70ed029

Browse files
committed
More updates
1 parent 8af1207 commit 70ed029

File tree

5 files changed

+80
-44
lines changed

5 files changed

+80
-44
lines changed

docs/codeql/codeql-for-visual-studio-code/customizing-settings.rst

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -72,36 +72,38 @@ Configuring settings for variant analysis
7272
You can define or edit lists of GitHub repositories for variant analysis, and change to a different controller repository using the **Variant analysis** settings.
7373

7474
For information on the purpose and requirements for a controller repository, see ":ref:`About the controller repository <controller-repository>`."
75-
TODO
76-
The items shown in the Variant Analysis Repositories panel can also be managed by editing a file in your VS Code workspace called databases.json. This file contains a JSON representation of all the items displayed in the panel. To open your databases.json file in an editor window, click the { } icon in the top right of the variant analysis repositories panel. You can then see a structured representation of the repos, orgs and lists in your panel. For example:
77-
78-
{
79-
"version": 1,
80-
"databases": {
81-
"variantAnalysis": {
82-
"repositoryLists": [
83-
{
84-
"name": "My favourite JavaScript repos",
85-
"repositories": [
86-
"facebook/react",
87-
"babel/babel",
88-
"angular/angular"
89-
]
90-
}
91-
],
92-
"owners": [
93-
"microsoft"
94-
],
95-
"repositories": [
96-
"apache/hadoop"
97-
]
75+
76+
You can also edit the items shown in the Variant analysis repositories panel by editing a file in your Visual Studio Code workspace called ``databases.json``. This file contains a JSON representation of all the items displayed in the panel. To open your ``databases.json`` file in an editor window, click the **{ }** icon in the top right of the variant analysis repositories panel. You can then see a structured representation of the repos, orgs and lists in your panel. For example:
77+
78+
.. code-block:: json
79+
80+
{
81+
"version": 1,
82+
"databases": {
83+
"variantAnalysis": {
84+
"repositoryLists": [
85+
{
86+
"name": "My favourite JavaScript repos",
87+
"repositories": [
88+
"facebook/react",
89+
"babel/babel",
90+
"angular/angular"
91+
]
92+
}
93+
],
94+
"owners": [
95+
"microsoft"
96+
],
97+
"repositories": [
98+
"apache/hadoop"
99+
]
100+
}
101+
},
102+
"selected": {
103+
"kind": "variantAnalysisSystemDefinedList",
104+
"listName": "top_10"
98105
}
99-
},
100-
"selected": {
101-
"kind": "variantAnalysisSystemDefinedList",
102-
"listName": "top_10"
103106
}
104-
}
105107
106108
You can change the items shown in the panel or add new items by directly editing this file.
107109

docs/codeql/codeql-for-visual-studio-code/running-codeql-queries-at-scale-with-mrva.rst

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ When you write a query to find variants of a security vulnerability and finish t
1414

1515
The core functionality of the CodeQL extension helps you write queries and run them locally against a CodeQL database. In contrast, variant analysis allows you to send your CodeQL query to GitHub.com to be tested against a list of repositories.
1616

17+
When you run variant analysis against a list of repositories, your query is run against each repository that has a CodeQL database available to analyze. GitHub creates and stores CodeQL databases for thousands of public repositories, including every repository that runs code scanning using CodeQL. If you want to include your repositories in variant analysis, you need to enable code scanning using CodeQL on GitHub.com before adding your repository to a list for analysis. For information about enabling code scanning using CodeQL, see "`Configuring code scanning automatically <https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning-for-a-repository#configuring-code-scanning-automatically>`__."
18+
1719
.. _controller-repository:
1820

1921
About the controller repository
@@ -69,7 +71,16 @@ Running a query at scale using variant analysis
6971

7072
#. Expand the **Variant Analysis Repositories** section, to show the default lists of the top 10, top 100, and top 1000 public repositories on GitHub.com. These are ranked by considering various metrics such as number of stars, number of watchers, number of forks etc.
7173

72-
#. Select the **Top 10 repositories** to test your query against.
74+
#. Select which GitHub repository or repositories you want to run your query against.
75+
76+
- Select **Top X repositories**.
77+
- Click **Add new database**, the **+** icon, to select either a single repository, or all repositories in an organization.
78+
- Click **LIST-NAME** to select a custom list that you have created previously.
79+
- Click **Add new list**, the folder icon, to create a custom list (see later in this article for details).
80+
81+
.. image:: ../images/codeql-for-visual-studio-code/variant-analysis-repo-lists.png
82+
:width: 350
83+
:alt: Screenshot of the CodeQL extension in Visual Studio Code. The "Variant Analysis Repositories" section is expanded and the header buttons are highlighted with a dark orange outline. The "Top 10 repositories" item has a checkmark to show that it is currently selected.
7384

7485
#. Open the query you want to run, right-click in the query file, and select **CodeQL: Run Variant Analysis** to start variant analysis.
7586

@@ -111,25 +122,46 @@ To see the results for a repository:
111122
Exporting your results
112123
----------------------
113124

114-
#. Optionally, click **Export results** to export the results to a gist on GitHub.com or to a markdown file
125+
You can export your results for further analysis or to discuss them with collaborators. In the results view, click **Export results** to export the results to a gist on GitHub.com or to a markdown file.
115126

116-
117-
Creating your own lists of repositories
127+
Creating custom lists of repositories
118128
---------------------------------------
119129

120-
The Variant analysis repositories panel is used to select and manage the repos queried during variant analysis. We provide predefined lists of the most important repositories per language (Top 10, Top 100, or Top 1000) but you can also add your own lists, single repos, or GitHub organizations to the panel. To add new items, use the buttons located on the top right of the panel.
130+
After you have defined a controller repository, the Variant analysis repositories panel shows the lists of repositories that you can select for variant analysis. You can use the options in the panel header to select a specific repository or organization for variant analysis, and to create and manage custom lists of repositories for variant analysis.
131+
132+
.. pull-quote::
133+
134+
Note
135+
136+
CodeQL analysis always requires a CodeQL database to run queries against. When you run variant analysis against a list of repositories, your query will only be executed against the repositories that currently have a CodeQL database available to download. So the best way to make a repository available for variant analysis is to enable code scanning with CodeQL.
137+
138+
Selecting a single GitHub repository or organization for analysis
139+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140+
141+
#. In the Variant analysis repositories panel, click the **+**, add new database, icon.
121142

122-
Note: When you run variant analysis against a list of repositories, the query will only be executed against the repos that currently have a CodeQL database available to download. We store CodeQL databases for thousands of public repositories, including all repos that run code scanning. So the best way to make a repository available for variant analysis is to enable code scanning with CodeQL.
123-
Adding a single GitHub repository or organization for variant analysis
124-
Click the + icon.
125-
From the drop down menu, choose to either add a GitHub repository or a GitHub organisation/owner.
126-
Specify either the org/repo or org identifier in the text box.
127-
Adding a new list of repositories for variant analysis
128-
Click the +📁 icon.
129-
Specify a name for your list in the drop down text box and hit enter.
130-
Add repos to the list by first clicking on the name of the new list in the panel. Then click + and specify the org/repo identifier for each repo you want to add.
143+
#. From the dropdown menu, click **From a GitHub repository** or **All repositories of GitHub org or owner**.
131144

132-
#. Optionally, click **Copy repository list** to add a list of the repositories that have results for your query to the clipboard as JSON. For example:
145+
#. Type the identifier of the repository or organization that you want to use into the field.
146+
147+
.. image:: ../images/codeql-for-visual-studio-code/variant-analysis-repo-and-org.png
148+
:width: 350
149+
:alt: Screenshot of the CodeQL extension in Visual Studio Code. The "Variant Analysis Repositories" section is expanded to show a repository (octo-org/octo-repo) and an organization (octo-org). These items are highlighted with a dark orange outline.
150+
151+
Creating a custom list of repositories
152+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
153+
154+
#. In the Variant analysis repositories panel, click the |add-list| icon.
155+
156+
#. Type a name for the new list and press **Enter**.
157+
158+
#. Select your list in the panel and then click **+**, to add a repository to your list.
159+
160+
You can manage and edit your custom lists by right-clicking on either the list name, or a repository name within the list, and selecting an option from the context menu.
161+
162+
The custom lists are stored in your workspace in a ``databases.json`` file. If you want to edit this file directly, you can open by clicking **{ }** in the panel header.
163+
164+
For example, if you want to continue analyzing a set of repositories that had results for your query, click **Copy repository list** in the Variant analysis results view to add a list of the repositories that have results for your query to the clipboard as JSON. For example:
133165

134166
.. code-block:: json
135167
@@ -140,11 +172,13 @@ Add repos to the list by first clicking on the name of the new list in the panel
140172
]
141173
}
142174
143-
175+
You can then insert the ``new-repo-list`` of repositories into your list of custom repository lists for easy access in the Variant analysis repositories panel.
144176

145177
Troubleshooting variant analysis
146178
--------------------------------
147179

148180
For information on troubleshooting variant analysis, see
149181
":ref:`Troubleshooting variant analysis <troubleshooting-variant-analysis>`."
150182

183+
.. |add-list| image:: ../images/codeql-for-visual-studio-code/variant-analysis-add-list.png
184+
:height: 2ex
3.28 KB
Loading
54.9 KB
Loading
53.8 KB
Loading

0 commit comments

Comments
 (0)