Skip to content

Commit 35f349e

Browse files
committed
rfc7: break long test expressions to one per line
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.
1 parent 0423b90 commit 35f349e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

spec_7.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,24 @@ to one parameter per line, at the same indent level. Example:
8686
FLUX_NODEID_ANY,
8787
FLUX_RPC_RESPONSE);
8888
89+
10. Long test expressions connected by "AND" or "OR" operators SHOULD
90+
be broken to one test expression per line at the same indent level.
91+
Example:
92+
93+
.. code-block:: c
94+
95+
if (out->type == MY_EXPECTED_TYPE
96+
&& (out->bytes > MIN_BYTES
97+
&& out->bytes <= MAX_BYTES)) {
98+
...
99+
}
100+
101+
.. code-block:: c
102+
103+
if (flux_event_subscribe (h, "event.foo") < 0
104+
|| flux_event_subscribe (h, "event.bar") < 0) {
105+
...
106+
}
89107
90108
Variable Names
91109
==============

0 commit comments

Comments
 (0)