Skip to content

Commit ffa6792

Browse files
editorial
1 parent deb76e5 commit ffa6792

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

modules/ROOT/pages/styleguide.adoc

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ The purpose of the Cypher styleguide is to make queries as easy to read as possi
1010
For rules and recommendations for naming of labels, relationship types and properties, please see the xref::syntax/naming.adoc[Naming rules and recommendations].
1111

1212
The best way to make sure your queries follow the styling rules is to use `cypherfmt`, the official Cypher formatter.
13-
It is available as part of the https://marketplace.visualstudio.com/items?itemName=neo4j-extensions.neo4j-for-vscode[Neo4j VS Code Extension],
14-
and as a command line tool through the https://www.npmjs.com/package/@neo4j-cypher/language-support[Neo4j Cypher Language Support npm package].
15-
16-
13+
It is available as part of the https://marketplace.visualstudio.com/items?itemName=neo4j-extensions.neo4j-for-vscode[Neo4j VS Code Extension], and as a command line tool through the https://www.npmjs.com/package/@neo4j-cypher/language-support[Neo4j Cypher Language Support npm package].
1714

1815
[[cypher-styleguide-general-recommendations]]
1916
== General recommendations
@@ -24,7 +21,6 @@ and as a command line tool through the https://www.npmjs.com/package/@neo4j-cyph
2421
For example: `toString()`.
2522
* If you are storing Cypher statements in a separate file, use the file extension `.cypher`.
2623

27-
2824
[[cypher-styleguide-indentation-and-line-breaks]]
2925
== Indentation and line breaks
3026

@@ -121,8 +117,9 @@ WHERE EXISTS { (a)-->(b:B) }
121117
RETURN a.prop
122118
----
123119

124-
* Limit line length to 80 characters if possible. Line breaks should be applied starting from the outermost group, with each nested group breaking
125-
until either the line fits or no more line breaks can be inserted. Add two spaces of indentation for each nested broken group.
120+
* Limit line length to 80 characters if possible.
121+
Line breaks should be applied starting from the outermost group, with each nested group breaking until either the line fits or no more line breaks can be inserted.
122+
Add two spaces of indentation for each nested broken group.
126123

127124
.Bad
128125
[source, cypher]
@@ -145,7 +142,7 @@ WHERE
145142
RETURN n
146143
----
147144

148-
* Start ORDER BY and LIMIT clauses on new lines.
145+
* Start `ORDER BY` and `LIMIT` clauses on new lines.
149146

150147
.Bad
151148
[source, cypher]
@@ -163,7 +160,8 @@ ORDER BY n.prop
163160
LIMIT 10
164161
----
165162

166-
* A group containing a CASE expression should always split, and each WHEN, ELSE, and END should be put on a new line. Additionally, WHEN and ELSE should add two spaces of indentation.
163+
* A group containing a `CASE` expression should always break, and each `WHEN`, `ELSE`, and `END` should be put on a new line.
164+
Additionally, `WHEN` and `ELSE` should add two spaces of indentation.
167165

168166
.Bad
169167
[source, cypher]
@@ -180,11 +178,11 @@ RETURN
180178
CASE
181179
WHEN n.age >= 18 THEN 'Adult'
182180
ELSE 'Minor'
183-
END AS ageGroup-
181+
END AS ageGroup
184182
----
185183

186-
* Lines that end with a list or map literal and do not fit within the maximum width should leave
187-
the opening bracket/brace on the previous line and use only two additional spaces of indentation.
184+
* Lines that end with a list or map literal and do not fit within the maximum width should leave the opening bracket or brace on the preceding line.
185+
The contents of the literal should be indented two additional spaces from the line where the opening bracket or brace appears.
188186

189187
.Bad
190188
[source, cypher]

0 commit comments

Comments
 (0)