From aff08af608f089c7a0112e442f71a36f2f4f5d70 Mon Sep 17 00:00:00 2001 From: eiffel-org Date: Mon, 24 Jul 2017 13:18:23 +0000 Subject: [PATCH] Update wikipage Eiffel Coding Standard. (Signed-off-by:javier). git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@1903 abb3cda0-5349-4a8f-a601-0c33ac3a8c38 --- .../Eiffel-Coding-Standard.wiki | 86 ++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/documentation/17.05/eiffel/Coding_Standards/Eiffel-Coding-Standard.wiki b/documentation/17.05/eiffel/Coding_Standards/Eiffel-Coding-Standard.wiki index a0b16070..918fa046 100644 --- a/documentation/17.05/eiffel/Coding_Standards/Eiffel-Coding-Standard.wiki +++ b/documentation/17.05/eiffel/Coding_Standards/Eiffel-Coding-Standard.wiki @@ -1,4 +1,88 @@ [[Property:uuid|0CD0A1B2-42F8-48E0-B419-61B4DC076C1B]] [[Property:weight|2]] [[Property:title|Eiffel Coding Standard]] -[https://dev.eiffel.com/Eiffel_Coding_Standard|target="blank"|Eiffel Coding Standard] \ No newline at end of file + +==Language consideration== +* Do not put a blank line between +:* '''create''' and creation instructions +:* '''inherit''' and parent clauses +* Do not use assertion clauses without tag names. + +A sample of proper formatting of code: +note + description: "Descr...." + date: "$date: $" + +class A + +inherit + B + rename + f as g + end + +create + make + +feature {NONE} -- Initialization + + make (a: INTEGER) + -- Initialize Current with `a'. + do + end + +invariant + a_positive: a > 0 + +end + +==Style== +* If instructions: +if expr1 then + ... +elseif expr2 then + ... +else + ... +end + +If expressions are very long, break them on conjunctions as in: +if + expr1 or else + expr2 +then + ... +end + +* Loop instructions: +from + ... +until + ... +loop + ... +end + +* Inspect instructions: +inspect expr +when val1 then .... +else + ... +end + +or + +inspect + expr +when val1 then + ... +else + ... +end + +* For punctuation, we always have a space before '''(''' and a space after ''')''', ''',''', ''':''', or ''';''': +require + a_tag: query (a, b, c) or other_query (c, d) +local + i: INTEGER; j: INTEGER +