From 42a2037f3097db1ff7e7f26e85dae43057a1b39d Mon Sep 17 00:00:00 2001 From: Richard Helgeby Date: Wed, 30 Jul 2014 19:00:46 +0300 Subject: [PATCH] Add code guidelines document. --- docs/codestyle.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 docs/codestyle.txt diff --git a/docs/codestyle.txt b/docs/codestyle.txt new file mode 100644 index 0000000..dbcb42d --- /dev/null +++ b/docs/codestyle.txt @@ -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.