@@ -180,8 +180,9 @@ and is only left for compatibility.
180
180
All files in NEST start with a preamble, which contains the filename and the
181
181
NEST copyright text (see example below).
182
182
183
- Lines should not exceed 120 characters (clang-format). Files should not be too
184
- long (max. 2000 lines) (vera++:L006). No trailing whitespace (clang-format).
183
+ * Lines should not exceed 120 character
184
+ * Files should not be too long (max. 2000 lines)
185
+ * No trailing whitespace
185
186
186
187
Folders
187
188
*******
@@ -192,7 +193,7 @@ Variables and class members
192
193
***************************
193
194
194
195
In general, use meaningful, non-abbreviated names or follow naming conventions
195
- from the neuroscience field, e.g. the membrane potential is :hxt_ref: `V_m `. Use the
196
+ from the neuroscience field, for example, the membrane potential is :hxt_ref: `V_m `. Use the
196
197
``lower_case_under_lined `` notation. Private member variables should end with an
197
198
underscore (``name_ ``). If applicable, the general rule is use is to use the
198
199
same notation for biophysical quantities as is used in `Dayan&Abbot, 2001
@@ -227,8 +228,8 @@ from the neuroscience field, e.g. the membrane potential is :hxt_ref:`V_m`. Use
227
228
``lower_case_under_lined `` notation.
228
229
229
230
There should be a line-break after the method's return type (implementation
230
- only) (clang-format) . Parameters of methods should either fit into one line or
231
- each parameter is on a separate line (clang-format) .
231
+ only). Parameters of methods should either fit into one line or
232
+ each parameter is on a separate line.
232
233
233
234
.. code ::
234
235
@@ -244,9 +245,9 @@ Namespaces
244
245
**********
245
246
246
247
Use ``lower_case_under_lined `` notation for namespaces. Do not use ``using namespace ``
247
- statements in header files (vera++:T018) . The closing brace of a namespace should be
248
+ statements in header files. The closing brace of a namespace should be
248
249
followed by a comment containing the namespace statement.
249
- Do not indent the body of namespaces (clang-format) .
250
+ Do not indent the body of namespaces.
250
251
251
252
.. code ::
252
253
@@ -266,7 +267,7 @@ Use a ``struct`` only for passive objects that carry data; everything else is a
266
267
underscore (``State_ ``).
267
268
268
269
The access modifier (``public ``, ``protected ``, ``private ``) in class definitions are
269
- not indented (clang-format) .
270
+ not indented.
270
271
271
272
Do not implement methods inside the class definition, but implement small
272
273
``inline `` methods after the class definition and other methods in the
@@ -276,7 +277,7 @@ Template class declarations follow the same style as normal class declarations.
276
277
This applies in particular to inline declarations. The keyword template
277
278
followed by the list of template parameters appear on a separate line. The <
278
279
and > in template expressions have one space after and before the sign,
279
- respectively, e.g. ``std::vector< int > `` (clang-format) .
280
+ respectively, e.g., ``std::vector< int > ``.
280
281
281
282
.. code ::
282
283
@@ -295,16 +296,15 @@ Further indentation and formatting
295
296
Avoid committing indentation and formatting changes together with changes in
296
297
logic. Always commit these changes separately._
297
298
298
- As a general rule of thumb, always indent with two spaces (clang-format) . Do
299
- not use TAB character in any source file (vera++:L002) . Always use braces
300
- around blocks of code (vera++:T019) . The braces of code blocks have their own
301
- line (clang-format) .
299
+ As a general rule of thumb, always indent with two spaces. Do
300
+ not use TAB character in any source file. Always use braces
301
+ around blocks of code. The braces of code blocks have their own
302
+ line.
302
303
303
304
Control structures (``if ``, ``while ``, ``for ``, ...) have a single space after the
304
- keyword (clang-format / vera++:T003, T008). The parenthesis around the tests
305
- have a space after the opening and before the closing parenthesis
306
- (clang-format). The case labels in ``switch `` statements are not indented
307
- (clang-format).
305
+ keyword. The parenthesis around the tests
306
+ have a space after the opening and before the closing parenthesis.
307
+ The case labels in ``switch `` statements are not indented.
308
308
309
309
.. code ::
310
310
@@ -326,50 +326,19 @@ have a space after the opening and before the closing parenthesis
326
326
}
327
327
328
328
Binary operators (`+ `, `- `, `* `, `|| `, `& `, ...) are surrounded by one space, e.g.
329
- ``a + b `` (clang-format) .
329
+ ``a + b ``.
330
330
331
- Unary operators have no space between operator and operand, e.g. ``-a ``
332
- (clang-format). Do not use the negation operator `! ` since it can easily be
333
- overseen. Instead use ``not ``, e.g. ``not vec.empty() `` (vera++:T012) .
331
+ Unary operators have no space between operator and operand, e.g. ``-a ``.
332
+ Do not use the negation operator `! ` since it can easily be
333
+ overseen. Instead use ``not ``, e.g. ``not vec.empty() ``.
334
334
335
- There is no space between a statement and its corresponding semicolon
336
- (clang-format):
335
+ There is no space between a statement and its corresponding semicolon:
337
336
338
337
.. code ::
339
338
340
339
return a + 3 ; // bad
341
340
return a + 3; // good
342
341
343
- Further checks performed by vera++
344
- **********************************
345
-
346
- * **F001 ** Source files should not use the '\r ' (CR) character
347
- * **F002 ** File names should be well-formed
348
- * **L001 ** No trailing whitespace (clang-format)
349
- * **L003 ** no leading / ending empty lines
350
- * **L005 ** not to many (> 2) consecutive empty lines
351
- * **T001 ** One-line comments should not have forced continuation ( ``// ... \ ``)
352
- * **T002 ** Reserved names should not be used for preprocessor macros
353
- * **T004 ** Some keywords should be immediately followed by a colon (clang-format)
354
- * **T005 ** Keywords break and continue should be immediately followed by a semicolon (clang-format)
355
- * **T006 ** Keywords return and throw should be immediately followed by a semicolon or a single space (clang-format)
356
- * **T007 ** Semicolons should not be isolated by spaces or comments from the rest of the code (~ clang-format)
357
- * **T010 ** Identifiers should not be composed of 'l' and 'O' characters only
358
- * **T017 ** Unnamed namespaces are not allowed in header files
359
-
360
- Further transformations performed by clang-format
361
- *************************************************
362
-
363
- * Align trailing comments
364
- * Always break before multi-line strings
365
- * Always break template declarations
366
- * Break constructor initializers before comma
367
- * Pointer alignment: Left
368
- * Space before assignment operators
369
- * Spaces before trailing comments: 1
370
- * Spaces in parentheses
371
- * Spaces in square brackets
372
-
373
342
Stopwatch example
374
343
~~~~~~~~~~~~~~~~~
375
344
0 commit comments