Skip to content

Commit

Permalink
rfc7: break long test expressions to one per line
Browse files Browse the repository at this point in the history
Problem: We've adopted a defacto guideline that long test expressions
connected by "AND" or "OR" operators should be broken to one test
expression per line.  This is not documented.

Add this to RFC 7.
  • Loading branch information
chu11 committed Dec 2, 2024
1 parent 0423b90 commit 35f349e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec_7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,24 @@ to one parameter per line, at the same indent level. Example:
FLUX_NODEID_ANY,
FLUX_RPC_RESPONSE);
10. Long test expressions connected by "AND" or "OR" operators SHOULD
be broken to one test expression per line at the same indent level.
Example:

.. code-block:: c
if (out->type == MY_EXPECTED_TYPE
&& (out->bytes > MIN_BYTES
&& out->bytes <= MAX_BYTES)) {
...
}
.. code-block:: c
if (flux_event_subscribe (h, "event.foo") < 0
|| flux_event_subscribe (h, "event.bar") < 0) {
...
}
Variable Names
==============
Expand Down

0 comments on commit 35f349e

Please sign in to comment.