Skip to content

Commit 529dbe0

Browse files
committed
Address review comments. Reformat bullet lists with capitals and remove trailing punctuation.
1 parent c2ad56a commit 529dbe0

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

docs/ql-style-guide.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Words in *italic* are defined in the [Glossary](#glossary).
99
## Indentation
1010
1. *Always* use 2 spaces for indentation.
1111
1. *Always* indent:
12-
- the *body* of a module, newtype, class or predicate,
13-
- the second and subsequent lines after you use a line break to split a long line,
14-
- the *body* of a `from`, `where` or `select` clause where it spans multiple lines,
15-
- the *body* of a *quantifier* that spans multiple lines.
12+
- The *body* of a module, newtype, class or predicate
13+
- The second and subsequent lines after you use a line break to split a long line
14+
- The *body* of a `from`, `where` or `select` clause where it spans multiple lines
15+
- The *body* of a *quantifier* that spans multiple lines
1616

1717

1818
### Examples
@@ -43,15 +43,15 @@ select c, "This call to '$@' is deprecated because " + reason + ".",
4343
1. Lines *must not* exceed 100 characters.
4444
1. Long lines *should* be split with a line break, and the following lines *must* be indented one level until the next "regular" line break.
4545
1. There *should* be a single blank line:
46-
- between the file documentation and the first `import`,
47-
- before each declaration, except for the first declaration in a *body*,
48-
- before the `from`-`where`-`select` section in a query file.
46+
- Between the file documentation and the first `import`
47+
- Before each declaration, except for the first declaration in a *body*
48+
- Before the `from`-`where`-`select` section in a query file
4949
1. *Avoid* two or more adjacent blank lines.
5050
1. There *must* be a new line after the *annotations* `cached`, `deprecated`, `pragma`, `language` and `bindingset`. Other *annotations* do not have a new line.
5151
1. There *should not* be additional blank lines within a predicate.
5252
1. There *may* be a new line:
53-
- immediately after the `from`, `where` or `select` keywords in a query,
54-
- immediately after `if`, `then`, or `else` keywords. The `then` and `else` parts *should* be consistent.
53+
- Immediately after the `from`, `where` or `select` keywords in a query.
54+
- Immediately after `if`, `then`, or `else` keywords. The `then` and `else` parts *should* be consistent.
5555
1. *Avoid* other line breaks in declarations, other than to break long lines.
5656
1. When operands of *binary operators* span two lines, the operator *should* be placed at the end of the first line.
5757

@@ -109,7 +109,7 @@ select main, "Main method has no parameters."
109109
```
110110

111111
## Braces
112-
1. Braces follow "Stroustrup" style: The opening `{` *must* be placed at the end of the preceding line.
112+
1. Braces follow [Stroustrup](https://en.wikipedia.org/wiki/Indentation_style#Variant:_Stroustrup) style. The opening `{` *must* be placed at the end of the preceding line.
113113
1. The closing `}` *must* be placed on its own line, indented to the outer level, or be on the same line as the opening `{`.
114114
1. Braces of empty blocks *may* be placed on a single line, with a single space separating the braces.
115115
1. Short predicates, not exceeding the maximum line width, *may* be placed on a single line, with a space following the opening brace and preceding the closing brace.
@@ -128,19 +128,19 @@ class ThrowException extends ThrowExpr {
128128

129129
## Spaces
130130
1. There *must* be a space or line break:
131-
- surrounding each `=` and `|`,
132-
- after each comma.
131+
- Surrounding each `=` and `|`
132+
- After each `,`
133133
1. There *should* be a space or line break:
134-
- surrounding each *binary operator*, which *must* be balanced,
135-
- surrounding `..` in a range.
136-
- Exceptions to this are to save space or to improve readability.
134+
- Surrounding each *binary operator*, which *must* be balanced
135+
- Surrounding `..` in a range
136+
- Exceptions to this may be made to save space or to improve readability.
137137
1. *Avoid* other spaces, for example:
138-
- after a *quantifier/aggregation* keyword,
139-
- after the predicate name in a *call*,
140-
- inside brackets used for *calls*, single-line quantifiers, and parenthesised formulas,
141-
- surrounding a `.`,
142-
- inside the opening or closing `[ ]` In a range expression,
143-
- inside casts `a.(X)`.
138+
- After a *quantifier/aggregation* keyword
139+
- After the predicate name in a *call*
140+
- Inside brackets used for *calls*, single-line quantifiers, and parenthesised formulas
141+
- Surrounding a `.`
142+
- Inside the opening or closing `[ ]` in a range expression
143+
- Inside casts `a.(X)`
144144
1. *Avoid* multiple spaces, except for indentation, and *avoid* additional indentation to align formulas, parameters or arguments.
145145
1. *Do not* put whitespace on blank lines, or trailing on the end of a line.
146146
1. *Do not* use tabs.
@@ -159,18 +159,18 @@ private predicate foo(Expr e, Expr p) {
159159
```
160160

161161
## Naming
162-
1. Use PascalCase for:
163-
- `class` names,
164-
- `module` names,
165-
- `newtype` names.
166-
1. Use camelCase for:
167-
- predicate names,
168-
- variable names.
162+
1. Use [PascalCase](http://wiki.c2.com/?PascalCase) for:
163+
- `class` names
164+
- `module` names
165+
- `newtype` names
166+
1. Use [camelCase](https://en.wikipedia.org/wiki/Camel_case) for:
167+
- Predicate names
168+
- Variable names
169169
1. Newtype predicate names *should* begin with `T`.
170-
1. *Avoid* underscores in names.
171170
1. Predicates that have a result *should* be named `get...`
172171
1. Predicates that can return multiple results *should* be named `getA...` or `getAn...`
173172
1. Predicates that don't have a result or parameters *should* be named `is...` or `has...`
173+
1. *Avoid* underscores in names.
174174
1. *Avoid* short or single-letter names for classes, predicates and fields.
175175
1. Short or single letter names for parameters and *quantifiers* *may* be used provided that they are sufficiently clear.
176176
1. Use names as they are used in the target-language specification.
@@ -218,7 +218,7 @@ General requirements:
218218
1. Documentation comments *should* be appropriate for users of the code.
219219
1. Documentation for maintainers of the code *must* use normal comments.
220220

221-
Documenting specific items:
221+
Documentation for specific items:
222222

223223
1. Public declarations *must* be documented.
224224
1. Non-public declarations *should* be documented.
@@ -288,18 +288,18 @@ deprecated Expr getInitializer()
288288
1. The `or` keyword *may* be written at the end of a line, or within a line, provided that it has no unparenthesised `and` operands.
289289
1. Single-line formulas *may* be used in order to save space or add clarity, particularly in the *body* of a *quantifier/aggregation*.
290290
1. *Always* use brackets to clarify the precedence of:
291-
- `implies`,
292-
- `if`-`then`-`else`.
291+
- `implies`
292+
- `if`-`then`-`else`
293293
1. Parenthesised formulas *can* be written:
294-
- within a single line. There *should not* be an additional space following the opening parenthesis or preceding the closing parenthesis.
295-
- spanning multiple lines. The opening parenthesis *should* be placed at the end of the preceding line, the body should be indented one level, and the closing bracket should be placed on a new line at the outer indentation.
294+
- Within a single line. There *should not* be an additional space following the opening parenthesis or preceding the closing parenthesis.
295+
- Spanning multiple lines. The opening parenthesis *should* be placed at the end of the preceding line, the body should be indented one level, and the closing bracket should be placed on a new line at the outer indentation.
296296
1. *Quantifiers/aggregations* *can* be written:
297-
- within a single line. In this case, there is no space to the inside of the parentheses, or after the quantifier keyword.
298-
- across multiple lines. In this case, type declarations are on the same line as the quantifier, the `|` *may* be at the end of the line, or *may* be on its own line, and the body of the quantifier *must* be indented one level. The closing `)` is written on a new line, at the outer indentation.
297+
- Within a single line. In this case, there is no space to the inside of the parentheses, or after the quantifier keyword.
298+
- Across multiple lines. In this case, type declarations are on the same line as the quantifier, the `|` *may* be at the end of the line, or *may* be on its own line, and the body of the quantifier *must* be indented one level. The closing `)` is written on a new line, at the outer indentation.
299299
1. `if`-`then`-`else` *can* be written:
300-
- on a single line,
301-
- with the *body* after the `if`/`then`/`else` keyword,
302-
- with the *body* indented on the next line.
300+
- On a single line
301+
- With the *body* after the `if`/`then`/`else` keyword
302+
- With the *body* indented on the next line
303303
- *Always* parenthesise the `else` part if it is a compound formula.
304304
1. The `and` and `else` keywords *may* be placed on the same line as the closing parenthesis.
305305
1. The `and` and `else` keywords *may* be "cuddled": `) else (`

0 commit comments

Comments
 (0)