Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 26f0300

Browse files
author
james
committed
address anders' feedback
1 parent bebac21 commit 26f0300

1 file changed

Lines changed: 8 additions & 27 deletions

File tree

docs/query-help-style-guide.md

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ The header and single top-level `qhelp` element are both mandatory.
3232

3333
Section-level elements are used to group the information within the query help file. All query help files should include at least the following section elements, in the order specified:
3434

35-
1. `overview`—a summary of the purpose of the query, including an explanation of what the code does and the how the behavior of the program is affected.
35+
1. `overview`—a short summary of the issue that the query identifies, including an explanation of how it could affect the behavior of the program.
3636
2. `recommendation`—information on how to fix the issue highlighted by the query.
3737
3. `example`—an example of code showing the problem. Where possible, this section should also include a solution to the issue.
38-
4. `references`—relevant references to best practice.
38+
4. `references`—relevant references, such as authoritative sources on langauage semantics and best practice.
3939

4040
For further information about the other section-level, block, list and table elements supported by the qhelp format, see [Qhelp files](https://wiki.semmle.com/display/SD/Qhelp+files).
4141

@@ -53,32 +53,11 @@ You should write the overview and recommendation elements in simple English that
5353

5454
Whenever possible, you should include a code example that helps to explain the issue you are highlighting. Any code examples that you include should adhere to the following guidelines:
5555

56-
* The example should be less than 20 lines and ideally it should be runnable. If this is not possible, ensure that the example very clearly illustrates the issue that you are highlighting.
56+
* The example should be less than 20 lines, but it should still clearly illustrate the issue that the query identifies. If appropriate, then the example may also be runnable.
5757
* Put the code example after the recommendation element where possible. Only include an example in the description element if absolutely necessary.
5858
* If you are using an example to illustrate the solution to a problem, and the change required is minor, avoid repeating the whole example. It is preferable to either describe the change required or to include a smaller snippet of the corrected code.
5959
* Clearly indicate which of the samples is an example of bad coding practice and which is recommended practice.
60-
61-
There are several ways of including a code example in a query help file:
62-
63-
* Directly include the code as nested text in the `example` section, Use the `sample` block and define a `language` attribute to specify the language of the example:
64-
65-
```
66-
<example>
67-
<p>This example highlights poor coding practice</p>
68-
<sample language = "java" />
69-
70-
Example of poor code
71-
72-
<p>This example shows how to fix the code</p>
73-
<sample language = "java" />
74-
75-
Example of correct code
76-
77-
</example>
78-
```
79-
80-
81-
* Define the code example in a `src` file. The language is inferred from the file extension:
60+
* Define the code examples in `src` files. The language is inferred from the file extension:
8261

8362
```
8463
<example>
@@ -91,10 +70,12 @@ Example of correct code
9170
<sample src = "example-code-fixed.java" />
9271
</example>
9372
```
94-
73+
74+
Note, if any code words are included in the `overview` and `recommendation` sections, they should be formatted with `<code> ... </code>` for emphasis.
75+
9576
## Including references
9677

97-
You should include one or more references to provide further information about the problem that your query is designed to find. References can be of the following types:
78+
You should include one or more references, list formatted with `<li> ... </li>` for each item, to provide further information about the problem that your query is designed to find. References can be of the following types:
9879

9980
### Books
10081

0 commit comments

Comments
 (0)