Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
fr:guides:coding-conventions [2016/07/29 06:49]
brice
fr:guides:coding-conventions [2016/07/29 06:53] (Version actuelle)
brice
Ligne 1: Ligne 1:
 ====== Conventions de codage ====== ====== Conventions de codage ======
  
-<WRAP center round todo 60%> +La source ​est seulement disponible en [[en:guides:coding-conventions|anglais]] pour l'instant.
-Importé de la traduction anglaise. Toute aide est la bienvenue pour finir la traduction. +
-</​WRAP>​ +
- +
-Ekylibre projects are based on one idea at every level**Simplicity ⇒ Reliability ⇒ Adherence**. +
-Ekylibre follows a simple set of coding ​style conventions+
- +
-  * All programming code must be in English as possible +
-  * Follow Rails conventions:​ +
-    * Two spaces, no tabs (for indentation). +
-    * No trailing whitespace. Blank lines should not have any spaces. +
-    * <​del>​Indent after private/​protected.</​del>​ +
-    * Use Ruby ≥ 1.9 syntax for hashes. Prefer ''​{ a: :b }''​ over ''​{ :a => :b }''​. +
-    * Prefer ''&&''/''​||'' over ''​and''/''​or''​. +
-    * Prefer ''​class << self''​ over ''​self.method''​ for class methods. +
-    * Use ''​MyClass.my_method(my_arg)''​ not ''​my_method( my_arg )''​ or ''​my_method my_arg''​. +
-    * Use ''​a = b''​ and not ''​a=b''​. +
-    * Use ''​assert_not''​ methods instead of ''​refute''​. +
-    * Prefer ''​method { do_stuff }''​ instead of ''​method{do_stuff}''​ for single-line blocks. +
-    * Follow the conventions in the source you see used already. +
-  * No abbreviation +
-  * No ambiguity +
-  * Explain models methods in a comment in code +
-  * Avoid some keywords everywhere (''​alias'',​ ''​and'',​ ''​break'',​ ''​case'',​ ''​class'',​ ''​def'',​ ''​default'',​ ''​do'',​ ''​else'',​ ''​elsif'',​ ''​ensure'',​ ''​false'',​ ''​if'',​ ''​include'',​ ''​location'',​ ''​module'',​ ''​next'',​ ''​nil'',​ ''​not'',​ ''​or'',​ ''​redo'',​ ''​require'',​ ''​rescue'',​ ''​retry'',​ ''​return'',​ ''​self'',​ ''​super'',​ ''​then'',​ ''​true'',​ ''​type'',​ ''​undef'',​ ''​unless'',​ ''​until'',​ ''​when'',​ ''​while'',​ and ''​yield''​). Consequences are: +
-    * //Type// models are named as //Nature// models. Example: If you need to manage foo types, use ''​FooNature''​ instead of ''​FooType''​. +
-    * Use ''​by_default''​ expression in replacement of ''​default''​ +
-  * Use meaningful names everywhere. +
-  * Follow migration guidelines:​ +
-    * Date columns name must be constructed as conjugated verb followed by ''​_on''​ suffix. Example: ''​moved_on''​ +
-    * Datetime columns name must be constructed as conjugated verb followed by ''​_at''​ suffix. Example: ''​moved_at''​ +
-    * Each reference column must be indexed +
-    * Always add ''​stamps''​ columns in all tables you create. +
-    * For GIS DB columns, use only Postgis columns: ''​st_point''​ in place of ''​point''​ and ''​st_polygon''​ in place of ''​polygon''​ +
-    * Every decimal rate column must be ''​decimal(19,​10)''​ +
-    * All other decimal column must be ''​decimal(19,​4)''​ +
-    * Every boolean column must be mandatory and false by default (''​null:​ false, default: false''​) +
-  * Write an help file for each ''​backend''​ controller with views+