Skip to content

Commit 4aa92df

Browse files
authored
Updates from review comments
1 parent 169a465 commit 4aa92df

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

docs/codeql/writing-codeql-queries/introduction-to-ql.rst

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ QL also supports recursion and aggregates. This allows you to write complex recu
1919
Running a query
2020
---------------
2121

22-
You can try out the following examples and exercises using :ref:`CodeQL for VS Code <codeql-for-visual-studio-code>` or the `CodeQL template <https://github.com/codespaces/new?template_repository=github/codeql-codespaces-template>'.
22+
You can try out the following examples and exercises using :ref:`CodeQL for VS Code <codeql-for-visual-studio-code>` or the `CodeQL template <https://github.com/codespaces/new?template_repository=github/codeql-codespaces-template>' on GitHub Codespaces.
2323

2424
Here is an example of a basic query:
2525

2626
.. code-block:: ql
2727

28-
import <language>
28+
import tutorial
2929

3030
select "hello world"
3131

@@ -111,11 +111,13 @@ Example CodeQL queries
111111
----------------------
112112

113113
The previous examples used the primitive types built in to QL. Although we chose a project to query, we didn't use the information in that project's database.
114-
The following example queries *do* use these databases and give you an idea of how to use CodeQL to analyze projects.
114+
The following example queries *do* use these databases and give you an idea of how to use CodeQL to analyze projects.
115115

116116
Queries using the CodeQL libraries can find errors and uncover variants of important security vulnerabilities in codebases.
117117
Visit `GitHub Security Lab <https://securitylab.github.com/>`__ to read about examples of vulnerabilities that we have recently found in open source projects.
118118

119+
Before you can run the following examples, you will need to install the CodeQL extension for Visual Studio Code. For more information, see :ref:`Setting up CodeQL in Visual Studio Code <setting-up-codeql-in-visual-studio-code>`. You will also need to import and select a database in the corresponding programming language. For more information about obtaining CodeQL databases, see `Analyzing your projects <https://codeql.github.com/docs/codeql-for-visual-studio-code/analyzing-your-projects/#choosing-a-database>`__ in the CodeQL for VS Code documentation.
120+
119121
To import the CodeQL library for a specific programming language, type ``import <language>`` at the start of the query.
120122

121123
.. code-block:: ql
@@ -163,6 +165,8 @@ Exercise 1
163165

164166
.. code-block:: ql
165167
168+
import tutorial
169+
166170
from string s
167171
where s = "lgtm"
168172
select s.length()
@@ -171,13 +175,17 @@ There is often more than one way to define a query. For example, we can also wri
171175

172176
.. code-block:: ql
173177
178+
import tutorial
179+
174180
select "lgtm".length()
175181
176182
Exercise 2
177183
~~~~~~~~~~
178184

179185
.. code-block:: ql
180186
187+
import tutorial
188+
181189
from float x, float y
182190
where x = 3.pow(5) and y = 245.6
183191
select x.minimum(y).sin()
@@ -187,6 +195,8 @@ Exercise 3
187195

188196
.. code-block:: ql
189197
198+
import tutorial
199+
190200
from boolean b
191201
where b = false
192202
select b.booleanNot()
@@ -196,6 +206,8 @@ Exercise 4
196206

197207
.. code-block:: ql
198208
209+
import tutorial
210+
199211
from date start, date end
200212
where start = "10/06/2017".toDate() and end = "28/09/2017".toDate()
201213
select start.daysTo(end)

0 commit comments

Comments
 (0)