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-for-visual-studio-code/customizing-settings.rst
+30-28Lines changed: 30 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,36 +72,38 @@ Configuring settings for variant analysis
72
72
You can define or edit lists of GitHub repositories for variant analysis, and change to a different controller repository using the **Variant analysis** settings.
73
73
74
74
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"
98
105
}
99
-
},
100
-
"selected": {
101
-
"kind": "variantAnalysisSystemDefinedList",
102
-
"listName": "top_10"
103
106
}
104
-
}
105
107
106
108
You can change the items shown in the panel or add new items by directly editing this file.
Copy file name to clipboardExpand all lines: docs/codeql/codeql-for-visual-studio-code/running-codeql-queries-at-scale-with-mrva.rst
+50-16Lines changed: 50 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,8 @@ When you write a query to find variants of a security vulnerability and finish t
14
14
15
15
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.
16
16
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
+
17
19
.. _controller-repository:
18
20
19
21
About the controller repository
@@ -69,7 +71,16 @@ Running a query at scale using variant analysis
69
71
70
72
#. 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.
71
73
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).
: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.
73
84
74
85
#. Open the query you want to run, right-click in the query file, and select **CodeQL: Run Variant Analysis** to start variant analysis.
75
86
@@ -111,25 +122,46 @@ To see the results for a repository:
111
122
Exporting your results
112
123
----------------------
113
124
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.
115
126
116
-
117
-
Creating your own lists of repositories
127
+
Creating custom lists of repositories
118
128
---------------------------------------
119
129
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
#. In the Variant analysis repositories panel, click the **+**, add new database, icon.
121
142
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**.
131
144
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.
: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:
133
165
134
166
.. code-block:: json
135
167
@@ -140,11 +172,13 @@ Add repos to the list by first clicking on the name of the new list in the panel
140
172
]
141
173
}
142
174
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.
144
176
145
177
Troubleshooting variant analysis
146
178
--------------------------------
147
179
148
180
For information on troubleshooting variant analysis, see
0 commit comments