Skip to content

Commit b4f7239

Browse files
committed
Updates from review
1 parent c1efb7f commit b4f7239

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.. pull-quote::
2+
3+
Note
4+
5+
For a guided introduction to CodeQL, we've created a `CodeQL template [Beta]<https://github.com/codespaces/new?template_repository=github/codeql-codespaces-template>`__ in GitHub Codespaces. You can use this template to test CodeQL concepts. However, if you would like to run CodeQL queries on code, you will need to install the CodeQL extension in Visual Studio Code. For instructions, see ":ref:`Setting up CodeQL in Visual Studio Code <setting-up-codeql-in-visual-studio-code>`."

docs/codeql/reusables/run-query-in-template.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

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

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ QL is a logic programming language, so it is built up of logical formulas. QL us
1414

1515
QL also supports recursion and aggregates. This allows you to write complex recursive queries using simple QL syntax and directly use aggregates such as ``count``, ``sum``, and ``average``.
1616

17+
.. include:: ../reusables/codespaces-template-note.rst
18+
1719
Running a query
1820
---------------
1921

20-
You can try out the following examples and exercises using :ref:`CodeQL for VS Code <codeql-for-visual-studio-code>`, or you can run them in GitHub Codespaces using the `CodeQL template <https://github.com/codespaces/new?template_repository=github/codeql-codespaces-template>`__. This will open a GitHub Codespaces environment preconfigured to run CodeQL queries.
21-
22-
Once you open the GitHub Codespaces template, follow the instructions in the README to take a code tour and learn how to run queries in the workspace.
22+
You can try out the following examples and exercises using :ref:`CodeQL for VS Code <codeql-for-visual-studio-code>`.
2323

2424
Here is an example of a basic query:
2525

@@ -94,8 +94,6 @@ The exercises above all show queries with exactly one result, but in fact many q
9494
x*x + y*y = z*z
9595
select x, y, z
9696
97-
.. include:: ../reusables/run-query-in-template.rst
98-
9997
To simplify the query, we can introduce a class ``SmallInt`` representing the integers between 1 and 10. We can also define a predicate ``square()`` on integers in that class. Defining classes and predicates in this way makes it easy to reuse code without having to repeat it every time.
10098

10199
.. code-block:: ql
@@ -109,8 +107,6 @@ To simplify the query, we can introduce a class ``SmallInt`` representing the in
109107
where x.square() + y.square() = z.square()
110108
select x, y, z
111109
112-
.. include:: ../reusables/run-query-in-template.rst
113-
114110
Example CodeQL queries
115111
----------------------
116112

@@ -130,9 +126,7 @@ To import the CodeQL library for a specific programming language, type ``import
130126
where count(f.getAnArg()) > 7
131127
select f
132128
133-
➤ The ``from`` clause defines a variable ``f`` representing a Python function. The ``where`` part limits the functions ``f`` to those with more than 7 arguments. Finally, the ``select`` clause lists these functions.
134-
135-
.. include:: ../reusables/run-query-in-template.rst
129+
The ``from`` clause defines a variable ``f`` representing a Python function. The ``where`` part limits the functions ``f`` to those with more than 7 arguments. Finally, the ``select`` clause lists these functions.
136130

137131
.. code-block:: ql
138132
@@ -142,9 +136,7 @@ To import the CodeQL library for a specific programming language, type ``import
142136
where c.getText().regexpMatch("(?si).*\\bTODO\\b.*")
143137
select c
144138
145-
➤ The ``from`` clause defines a variable ``c`` representing a JavaScript comment. The ``where`` part limits the comments ``c`` to those containing the word ``"TODO"``. The ``select`` clause lists these comments.
146-
147-
.. include:: ../reusables/run-query-in-template.rst
139+
The ``from`` clause defines a variable ``c`` representing a JavaScript comment. The ``where`` part limits the comments ``c`` to those containing the word ``"TODO"``. The ``select`` clause lists these comments.
148140

149141
.. code-block:: ql
150142
@@ -154,9 +146,7 @@ To import the CodeQL library for a specific programming language, type ``import
154146
where not exists(p.getAnAccess())
155147
select p
156148
157-
➤ The ``from`` clause defines a variable ``p`` representing a Java parameter. The ``where`` clause finds unused parameters by limiting the parameters ``p`` to those which are not accessed. Finally, the ``select`` clause lists these parameters.
158-
159-
.. include:: ../reusables/run-query-in-template.rst
149+
The ``from`` clause defines a variable ``p`` representing a Java parameter. The ``where`` clause finds unused parameters by limiting the parameters ``p`` to those which are not accessed. Finally, the ``select`` clause lists these parameters.
160150

161151
Further reading
162152
---------------

0 commit comments

Comments
 (0)