Skip to content

Commit 91a8391

Browse files
author
Felicity Chapman
authored
Merge pull request github#2037 from jf205/python-docs-fixes
docs: fix some formatting issues
2 parents d4fa14a + 3a4cef6 commit 91a8391

14 files changed

+48
-34
lines changed

docs/language/learn-ql/cpp/conversions-classes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Unlike the earlier versions of the query, this query would return each side of t
128128

129129
Note
130130

131-
In general, QL predicates named ``getAXxx`` exploit the ability to return multiple results (multiple instances of ``Xxx``) whereas plain ``getXxx`` predicates usually return at most one specific instance of ``Xxx``.
131+
In general, QL predicates named ``getAXxx`` exploit the ability to return multiple results (multiple instances of ``Xxx``) whereas plain ``getXxx`` predicates usually return at most one specific instance of ``Xxx``.
132132

133133
Classes
134134
-------

docs/language/learn-ql/cpp/function-classes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ This query returns fewer results. However, if you examine the results then you c
6060

6161
For example, there is a more complicated LGTM `query <https://lgtm.com/rules/2152580467/>`__ that finds unused static functions. To see the QL code for this query, click **Open in query console** at the top of the page.
6262

63+
.. pull-quote::
64+
65+
Tip
66+
6367
You can explore the definition of an element in the standard QL libraries and see what predicates are available. Use the keyboard **F3** button to open the definition of any element. Alternatively, hover over the element and click **Jump to definition** in the tooltip displayed. The library file is opened in a new tab with the definition highlighted.
6468

6569
Finding a specific function

docs/language/learn-ql/cpp/introduce-libraries-cpp.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ There is an extensive QL library for analyzing C/C++ code. The QL classes in thi
1212
1313
The rest of this topic briefly summarizes the most important QL classes and predicates provided by this library.
1414

15+
.. pull-quote::
16+
17+
Tip
18+
1519
You can find related classes and features using the query console's auto-complete feature. You can also press **F3** to jump to the definition of any element (QL library files are opened in new tabs in the console).
1620

1721
Summary of the library classes

docs/language/learn-ql/cpp/zero-space-terminator.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ Now we can write a query using these classes:
8787
8888
Note that there is no need to check whether anything is added to the ``strlen`` expression, as it would be in the corrected C code ``malloc(strlen(string) + 1)``. This is because the corrected code would in fact be an ``AddExpr`` containing a ``StrlenCall``, not an instance of ``StrlenCall`` itself. A side-effect of this approach is that we omit certain unlikely patterns such as ``malloc(strlen(string) + 0``). In practice we can always come back and extend our query to cover this pattern if it is a concern.
8989

90+
.. pull-quote::
91+
92+
Tip
93+
9094
For some projects, this query may not return any results. Possibly the project you are querying does not have any problems of this kind, but it is also important to make sure the query itself is working properly. One solution is to set up a test project with examples of correct and incorrect code to run the query against (the C code at the very top of this page makes a good starting point). Another approach is to test each part of the query individually to make sure everything is working.
9195

9296
When you have defined the basic query then you can refine the query to include further coding patterns or to exclude false positives:

docs/language/learn-ql/csharp/ql-for-csharp.rst

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,8 @@ These topics provide an overview of the QL C# libraries and show examples of how
1414

1515
- :doc:`Introducing the C# libraries <introduce-libraries-csharp>` introduces the standard libraries used to write queries for C# code.
1616

17-
.. raw:: html
18-
19-
<!-- Working with generic types and methods(generics) - how to query generic types and methods. -->
20-
2117
- :doc:`Tutorial: Analyzing data flow in C# <dataflow>` demonstrates how to write queries using the standard QL for C# data flow and taint tracking libraries.
2218

23-
.. raw:: html
24-
25-
<!-- Working with call graphs(call-graph) - how to construct and query call graphs, and work with dynamic and virtual dispatch. -->
26-
27-
.. raw:: html
28-
29-
<!-- Working with control flow(control-flow) - how to query intra-procedural control flow. -->
30-
31-
.. raw:: html
32-
33-
<!-- Working with comments(comments) - how to query comments and XML documentation. -->
3419

3520
Other resources
3621
---------------

docs/language/learn-ql/java/call-graph.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ Given this API, we can easily write a query that finds methods that are not call
7878
7979
➤ `See this in the query console <https://lgtm.com/query/665280012/>`__. This simple query typically returns a large number of results.
8080

81+
.. pull-quote::
82+
8183
Note
8284

8385
We have to use ``polyCalls`` instead of ``calls`` here: we want to be reasonably sure that ``callee`` is not called, either directly or via overriding.

docs/language/learn-ql/java/expressions-statements.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Specifically, consider the following code snippet:
1818
1919
If ``l`` is bigger than 2\ :sup:`31`\ - 1 (the largest positive value of type ``int``), then this loop will never terminate: ``i`` will start at zero, being incremented all the way up to 2\ :sup:`31`\ - 1, which is still smaller than ``l``. When it is incremented once more, an arithmetic overflow occurs, and ``i`` becomes -2\ :sup:`31`\, which also is smaller than ``l``! Eventually, ``i`` will reach zero again, and the cycle repeats.
2020

21+
.. pull-quote::
22+
2123
More about overflow
2224

2325
All primitive numeric types have a maximum value, beyond which they will wrap around to their lowest possible value (called an "overflow"). For ``int``, this maximum value is 2\ :sup:`31`\ - 1. Type ``long`` can accommodate larger values up to a maximum of 2\ :sup:`63`\ - 1. In this example, this means that ``l`` can take on a value that is higher than the maximum for type ``int``; ``i`` will never be able to reach this value, instead overflowing and returning to a low value.

docs/language/learn-ql/java/introduce-libraries-java.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ The library is implemented as a set of QL modules, that is, files with the exten
1414
1515
The rest of this topic briefly summarizes the most important QL classes and predicates provided by this library.
1616

17+
.. pull-quote::
18+
19+
Note
20+
1721
The example queries in this topic illustrate the types of results returned by different library classes. The results themselves are not interesting but can be used as the basis for developing a more complex query. The tutorial topics show how you can take a simple query and fine-tune it to find precisely the results you're interested in.
1822

1923
Summary of the library classes
@@ -315,7 +319,11 @@ Class ``Javadoc`` represents an entire Javadoc comment as a tree of ``JavadocEle
315319
316320
➤ `See this in the query console <https://lgtm.com/query/670490015/>`__. None of the LGTM.com demo projects uses the ``@author`` tag on private fields.
317321

318-
Note that on line 5 we used ``getParent+`` to capture tags that are nested at any depth within the Javadoc comment.
322+
.. pull-quote::
323+
324+
Note
325+
326+
On line 5 we used ``getParent+`` to capture tags that are nested at any depth within the Javadoc comment.
319327

320328
For more information on working with Javadoc, see the :doc:`tutorial on Javadoc <javadoc>`.
321329

docs/language/learn-ql/java/types-class-hierarchy.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ To determine ancestor types (including immediate super types, and also *their* s
3232
3333
➤ `See this in the query console <https://lgtm.com/query/674620010/>`__. If this query were run on the example snippet above, the query would return ``A``, ``I``, and ``java.lang.Object``.
3434

35+
.. pull-quote::
36+
3537
Tip
3638

3739
If you want to see the ___location of ``B`` as well as ``A``, you can replace ``B.getASupertype+()`` with ``B.getASupertype*()`` and re-run the query.

docs/language/learn-ql/javascript/introduce-libraries-js.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ The `TopLevel <https://help.semmle.com/qldoc/javascript/semmle/javascript/AST.ql
224224

225225
.. pull-quote::
226226

227-
Note
227+
Note
228228

229229
By default, LGTM filters out alerts in minified top-levels, since they are often hard to interpret. When writing your own queries in the LGTM query console, this filtering is *not* done automatically, so you may want to explicitly add a condition of the form ``and not e.getTopLevel().isMinified()`` or similar to your query to exclude results in minified code.
230230

0 commit comments

Comments
 (0)