Convention: use colon as separator in comments within code blocks (#4425)
Co-authored-by: Loïc Joly <loic.joly@sonarsource.com>
This commit is contained in:
parent
4d35623ab6
commit
3837a175d3
@ -271,14 +271,22 @@ tsql:: use `sql`
|
||||
|
||||
In case no language is appropriate for a code block (for example shared examples between multiple languages), you can use `text` as the language.
|
||||
|
||||
=== References within code blocks
|
||||
=== Comments within code blocks
|
||||
|
||||
Colon (`:`) should be used as separator between `Noncompliant`/`Compliant` comments and the text explanation that follows, if any.
|
||||
|
||||
[source,cpp]
|
||||
----
|
||||
int X = 2; // Noncompliant: variable should be in lowercase
|
||||
----
|
||||
|
||||
|
||||
When referencing a name within a comment in a code example, use double quotes to make it clear it refers to an existing element in the code.
|
||||
|
||||
[source,cpp]
|
||||
----
|
||||
int i = 0;
|
||||
cout << noexcept(++i); // Noncompliant, "i" is not incremented
|
||||
cout << noexcept(++i); // Noncompliant: "i" is not incremented
|
||||
----
|
||||
|
||||
=== Diff view
|
||||
|
Loading…
x
Reference in New Issue
Block a user