Add code guidelines document.

This commit is contained in:
Richard Helgeby 2014-07-30 19:00:46 +03:00
parent 3430e82b57
commit 42a2037f30

23
docs/codestyle.txt Normal file
View File

@ -0,0 +1,23 @@
Zombie:Reloaded Code Guidelines
===============================
This is a draft of coding guidelines for Zombie:Reloaded. If something is not
mentioned here, study the existing code to ensure consistency.
Most of the code was written before we decided on the code style, so we may even
break our own rules according to this document.
Highly recommended book:
Clean Code: A Handbook of Agile Software Craftsmanship (2008)
Robert C. Martin
* Curly braces on separate lines.
* Indent with 4 spaces instead of tabs (configure your editor).
* Unix line endings.
* Always use curly braces with control statements (if, for, while, do).
* UTF-8 file encoding without BOM.
* Extract code into multiple functions if code is too complex. ZR is still bad
at following this rule.
* If the code needs comments, it should be refactored/renamed to better explain
what it's doing. ZR has a lot of unnecessary comments, mostly because it's not
following the single purpose-function rule above.