Skip to content

Commit 6ae842c

Browse files
author
Felicity Chapman
committed
Update QL handbook issues highlighted by Vale
1 parent 6d10731 commit 6ae842c

File tree

8 files changed

+58
-58
lines changed

8 files changed

+58
-58
lines changed

docs/ql-documentation/ql-handbook/annotations.rst

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ You can also find a summary table in the Annotations section of the
4545
.. index:: abstract
4646
.. _abstract:
4747

48-
abstract
49-
========
48+
``abstract``
49+
============
5050

5151
**Available for**: |classes|, |member predicates|
5252

@@ -89,8 +89,8 @@ own body, or they must inherit from another class that overrides ``isSource``::
8989
.. index:: cached
9090
.. _cached:
9191

92-
cached
93-
======
92+
``cached``
93+
==========
9494

9595
**Available for**: |classes|, |algebraic datatypes|, |characteristic predicates|, |member predicates|, |non-member predicates|, |modules|
9696

@@ -112,8 +112,8 @@ body must also be annotated with ``cached``, otherwise a compiler error is repor
112112
.. index:: deprecated
113113
.. _deprecated:
114114

115-
deprecated
116-
==========
115+
``deprecated``
116+
==============
117117

118118
**Available for**: |classes|, |algebraic datatypes|, |member predicates|, |non-member predicates|, |fields|, |modules|, |aliases|
119119

@@ -141,8 +141,8 @@ This QLDoc comment appears when you use the name ``DataFlowNode`` in a QL editor
141141
.. index:: external
142142
.. _external:
143143

144-
external
145-
========
144+
``external``
145+
============
146146

147147
**Available for**: |non-member predicates|
148148

@@ -152,8 +152,8 @@ predicate. This is similar to a :ref:`database predicate <database-predicates>`.
152152
.. index:: transient
153153
.. _transient:
154154

155-
transient
156-
=========
155+
``transient``
156+
=============
157157
**Available for**: |non-member predicates|
158158

159159
The ``transient`` annotation is applied to non-member predicates that are also annotated with ``external``,
@@ -163,8 +163,8 @@ without ``external``, the compiler will report an error.
163163
.. index:: final
164164
.. _final:
165165

166-
final
167-
=====
166+
``final``
167+
=========
168168

169169
**Available for**: |classes|, |member predicates|, |fields|
170170

@@ -185,8 +185,8 @@ change this definition. In this case, ``hasName`` should be final::
185185

186186
.. _library:
187187

188-
library
189-
=======
188+
``library``
189+
===========
190190

191191
**Available for**: |classes|
192192

@@ -202,8 +202,8 @@ compiler returns an error.
202202
.. index:: override
203203
.. _override:
204204

205-
override
206-
========
205+
``override``
206+
============
207207

208208
**Available for**: |member predicates|, |fields|
209209

@@ -216,8 +216,8 @@ warning.
216216
.. index:: private
217217
.. _private:
218218

219-
private
220-
=======
219+
``private``
220+
===========
221221

222222
**Available for**: |classes|, |algebraic datatypes|, |member predicates|, |non-member predicates|, |imports|, |fields|, |modules|, |aliases|
223223

@@ -229,8 +229,8 @@ module's :ref:`namespace <namespaces>`.
229229

230230
.. _query:
231231

232-
query
233-
=====
232+
``query``
233+
=========
234234

235235
**Available for**: |non-member predicates|, |aliases|
236236

@@ -265,25 +265,25 @@ and a call to that predicate ``... one(y) ...``. The QL optimizer may inline the
265265
You can use the following compiler pragma annotations to control the way the QL optimizer inlines
266266
predicates.
267267

268-
pragma[inline]
269-
--------------
268+
``pragma[inline]``
269+
------------------
270270

271271
The ``pragma[inline]`` annotation tells the QL optimizer to always inline the annotated predicate
272272
into the places where it is called. This can be useful when a predicate body is very expensive to
273273
compute entirely, as it ensures that the predicate is evaluated with the other contextual information
274274
at the places where it is called.
275275

276-
pragma[noinline]
277-
----------------
276+
``pragma[noinline]``
277+
--------------------
278278

279279
The ``pragma[noinline]`` annotation is used to prevent a predicate from being inlined into the
280280
place where it is called. In practice, this annotation is useful when you've already grouped
281281
certain variables together in a "helper" predicate, to ensure that the relation is evaluated
282282
in one piece. This can help to improve performance. The QL optimizer's inlining may undo the
283283
work of the helper predicate, so it's a good idea to annotate it with ``pragma[noinline]``.
284284

285-
pragma[nomagic]
286-
---------------
285+
``pragma[nomagic]``
286+
-------------------
287287

288288
The ``pragma[nomagic]`` annotation is used to prevent the QL optimizer from performing the "magic sets"
289289
optimization on a predicate.
@@ -295,8 +295,8 @@ by Semmle.
295295

296296
Note that ``nomagic`` implies ``noinline``.
297297

298-
pragma[noopt]
299-
-------------
298+
``pragma[noopt]``
299+
-----------------
300300

301301
The ``pragma[noopt]`` annotation is used to prevent the QL optimizer from optimizing a
302302
predicate, except when it's absolutely necessary for compilation and evaluation to work.
@@ -352,8 +352,8 @@ Language pragmas
352352

353353
**Available for**: |classes|, |characteristic predicates|, |member predicates|, |non-member predicates|
354354

355-
language[monotonicAggregates]
356-
-----------------------------
355+
``language[monotonicAggregates]``
356+
---------------------------------
357357

358358
This annotation allows you to use **monotonic aggregates** instead of the standard QL
359359
:ref:`aggregates <aggregations>`.
@@ -367,8 +367,8 @@ Binding sets
367367

368368
**Available for**: |characteristic predicates|, |member predicates|, |non-member predicates|
369369

370-
bindingset[...]
371-
---------------
370+
``bindingset[...]``
371+
-------------------
372372

373373
You can use this annotation to explicitly state the binding sets for a predicate. A binding set
374374
is a subset of the predicate's arguments such that, if those arguments are constrained to a

docs/ql-documentation/ql-handbook/expressions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Expressions
44
###########
55

66
An expression evaluates to a set of values in QL. For example, the expression ``1 + 2``
7-
evaluates to the integer ``3`` and the expression ``"QL"`` evaluates to the string "QL".
7+
evaluates to the integer ``3`` and the expression ``"QL"`` evaluates to the string ``"QL"``.
88

99
A valid expression also has a :ref:`type <types>`.
1010
In the above examples, ``1 + 2`` has type ``int`` and ``"QL"`` has type ``string``.
@@ -61,7 +61,7 @@ You can express certain values directly in QL, such as numbers, booleans, and st
6161

6262
Note: there is no "date literal" in QL. Instead, to specify a :ref:`date <date>`, you should
6363
convert a string to the date that it represents using the ``toDate()`` predicate. For example,
64-
``"2016-04-03".toDate()`` is the date 03/04/2016, and ``"2000-01-01 00:00:01".toDate()`` is the
64+
``"2016-04-03".toDate()`` is the date April 3, 2016, and ``"2000-01-01 00:00:01".toDate()`` is the
6565
point in time one second after New Year 2000.
6666

6767
The following string formats are recognized as dates:
@@ -274,7 +274,7 @@ The following aggregates are available in QL:
274274
.. index:: strictconcat, strictcount, strictsum
275275

276276
- ``strictconcat``, ``strictcount``, and ``strictsum``: These aggregates work like ``concat``,
277-
``count``, and ``sum`` respectively, except that they are "strict". That is, if there are no
277+
``count``, and ``sum`` respectively, except that they are *strict*. That is, if there are no
278278
possible assignments to the aggregation variables that satisfy the formula, then the entire aggregation fails and
279279
evaluates to the empty set (instead of defaulting to ``0`` or the empty string).
280280
This is useful if you're only interested in results where the aggregation body is non-trivial.

docs/ql-documentation/ql-handbook/formulas.rst

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Formulas define logical relations between the :ref:`free variables <free-variabl
77
:ref:`expressions <expressions>`.
88

99
Depending on the values assigned to those free variables, a formula can be true or false.
10-
When a formula is true, we often say that the formula "holds".
10+
When a formula is true, we often say that the formula *holds*.
1111
For example, the formula ``x = 4 + 5`` holds if the value ``9`` is assigned to ``x``, but it
1212
doesn't hold for other assignments to ``x``.
1313
Some formulas don't have any free variables. For example ``1 < 2`` always holds, and ``1 > 2``
@@ -185,8 +185,8 @@ mathematical logic.
185185

186186
.. index:: exists
187187

188-
exists
189-
------
188+
``exists``
189+
----------
190190

191191
This quantifier has the following syntax::
192192

@@ -203,8 +203,8 @@ type ``int`` and holds if any value of that variable has type ``OneTwoThree``.
203203

204204
.. index:: forall
205205

206-
forall
207-
------
206+
``forall``
207+
----------
208208

209209
This quantifier has the following syntax::
210210

@@ -223,8 +223,8 @@ logically the same as ``not exists(<vars> | <formula 1> | not <formula 2>)``.
223223

224224
.. index:: forex
225225

226-
forex
227-
-----
226+
``forex``
227+
---------
228228

229229
This quantifier has the following syntax::
230230

@@ -250,7 +250,7 @@ useful shorthand.
250250
Implicit quantifiers
251251
====================
252252

253-
Implicity quantified variables can be introduced using "don't care expressions". These are used
253+
Implicitly quantified variables can be introduced using "don't care expressions." These are used
254254
when you need to introduce a variable to use as an argument to a predicate call, but don't care
255255
about its value. For further information, see :ref:`Don't-care expressions <dont-care>`.
256256

@@ -287,8 +287,8 @@ languages. Here is a brief overview:
287287
.. index:: not, negation
288288
.. _negation:
289289

290-
not
291-
===
290+
``not``
291+
=======
292292

293293
You can use the keyword ``not`` before a formula. The resulting formula is called a negation.
294294

@@ -311,8 +311,8 @@ The following query selects files that are not HTML files.
311311
.. index:: if, then, else
312312
.. _conditional:
313313

314-
if ... then ... else
315-
====================
314+
``if ... then ... else``
315+
========================
316316

317317
You can use these keywords to write a conditional formula. This is another way to simplify
318318
notation: ``if A then B else C`` is the same as writing ``(A and B) or ((not A) and C)``.
@@ -331,8 +331,8 @@ a public class and returns ``"private"`` otherwise::
331331
.. index:: and, conjunction
332332
.. _conjunction:
333333

334-
and
335-
===
334+
``and``
335+
=======
336336

337337
You can use the keyword ``and`` between two formulas. The resulting formula is called a
338338
conjunction.
@@ -352,8 +352,8 @@ than 200 lines of code::
352352
.. index:: or, disjunction
353353
.. _disjunction:
354354

355-
or
356-
==
355+
``or``
356+
======
357357

358358
You can use the keyword ``or`` between two formulas. The resulting formula is called a
359359
disjunction.
@@ -375,8 +375,8 @@ With the following definition, an integer is in the class ``OneTwoThree`` if it
375375
.. index:: implies
376376
.. _implication:
377377

378-
implies
379-
=======
378+
``implies``
379+
===========
380380

381381
You can use the keyword ``implies`` between two formulas. The resulting formula is called an
382382
implication. This is just a simplified notation: ``A implies B`` is the same as writing ``(not A) or B``.

docs/ql-documentation/ql-handbook/modules.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Modules
44
#######
55

6-
Modules provide a way of organizing QL code by grouping together related types, predicates and other modules.
6+
Modules provide a way of organizing QL code by grouping together related types, predicates, and other modules.
77

88
You can import modules into other files, which avoids duplication, and helps
99
structure your code into more manageable pieces.

docs/ql-documentation/ql-handbook/name-resolution.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ In addition to the global module, type, and predicate namespaces, each module de
193193
module, type, and predicate namespaces.
194194

195195
For a module ``M``, it's useful to distinguish between its **declared**, **exported**, and **imported** namespaces.
196-
(These are described generically, but remember that there is always one for each of modules, types and predicates.)
196+
(These are described generically, but remember that there is always one for each of modules, types, and predicates.)
197197

198198
- The **declared** namespaces contain any names that are declared—that is, defined—in ``M``.
199199
- The **imported** namespaces contain any names exported by the modules that are imported into ``M`` using an

docs/ql-documentation/ql-handbook/queries.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Queries
55
#######
66

77
Queries are the output of a QL program: they evaluate to sets of results. Indeed, we
8-
often refer to the whole QL program as a "query".
8+
often refer to the whole QL program as a *query*.
99

1010
There are two kinds of queries. For a given :ref:`query module <query-modules>`, the queries in that module are:
1111
- The :ref:`select clause <select-clauses>`, if any, defined in that module.

docs/ql-documentation/ql-handbook/recursion.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ The following examples illustrate common mistakes that lead to invalid recursion
127127
Empty recursion
128128
===============
129129

130-
Firstly, a valid recursive definition must have a starting point or "base case".
130+
Firstly, a valid recursive definition must have a starting point or *base case*.
131131
If a recursive predicate evaluates to the empty set of values, there is usually something
132132
wrong.
133133

docs/ql-documentation/ql-handbook/types.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ An algebraic datatype is another form of user-defined type, declared with the ke
375375
Algebraic datatypes are used for creating new values that are neither primitive values nor entities from
376376
the database. One example is to model flow nodes when analyzing data flow through a program.
377377

378-
An algebraic datatype consists of a number of mutually disjoint "branches", that each define
378+
An algebraic datatype consists of a number of mutually disjoint *branches*, that each define
379379
a branch type. The algebraic datatype itself is the union of all the branch types.
380380
A branch can have arguments and a body. A new value of the branch type is produced for each set
381381
of values that satisfy the argument types and the body.

0 commit comments

Comments
 (0)