doc: tweak the coding conventions (#51113)

Encouraging to put container elements on their own lines to minimize
diffs, merge conflicts and making re-ordering easier.

Nix doesn't suffer the restrictions of other languages where commas are
used to separate list items.
This commit is contained in:
zimbatm 2018-11-27 22:14:41 +01:00 committed by GitHub
parent 63c7ed9788
commit 064bd03b8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -56,25 +56,30 @@ foo { arg = ...; }
or list elements should be aligned: or list elements should be aligned:
<programlisting> <programlisting>
# A long list. # A long list.
list = list = [
[ elem1 elem1
elem2 elem2
elem3 elem3
]; ];
# A long attribute set. # A long attribute set.
attrs =
{ attr1 = short_expr;
attr2 =
if true then big_expr else big_expr;
};
# Alternatively:
attrs = { attrs = {
attr1 = short_expr; attr1 = short_expr;
attr2 = attr2 =
if true then big_expr else big_expr; if true then big_expr else big_expr;
}; };
# Combined
listOfAttrs = [
{
attr1 = 3;
attr2 = "fff";
}
{
attr1 = 5;
attr2 = "ggg";
}
];
</programlisting> </programlisting>
</para> </para>
</listitem> </listitem>