aboutsummaryrefslogtreecommitdiff
path: root/CODING.txt
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-10-11 16:17:35 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-10-11 16:17:35 +0000
commit6008f2d28266f9a5ca1c49bccea4a3a0766105f7 (patch)
tree706065c1d7e4627ea6e78e823b6fac90474a3d31 /CODING.txt
parent2f29c33e4874b90afeb1b6372acdc5e05164523f (diff)
downloadelgg-6008f2d28266f9a5ca1c49bccea4a3a0766105f7.tar.gz
elgg-6008f2d28266f9a5ca1c49bccea4a3a0766105f7.tar.bz2
Added coding styles and changes documents.
git-svn-id: http://code.elgg.org/elgg/trunk@3526 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'CODING.txt')
-rw-r--r--CODING.txt38
1 files changed, 38 insertions, 0 deletions
diff --git a/CODING.txt b/CODING.txt
new file mode 100644
index 000000000..a3b92096f
--- /dev/null
+++ b/CODING.txt
@@ -0,0 +1,38 @@
+These are the coding standards for Elgg. All core development, bundled
+plugins, and tickets attached to Trac are expected to be in this format.
+
+* Unix line endings
+* Hard tabs, 4 character tab spacing.
+* No shortcut tags ( <? or <?= or <% )
+* PHPDoc comments on functions and classes (including methods and declared
+ members).
+* Mandatory wrapped {}s around any code blocks.
+ Bad:
+ if (true)
+ foreach($arr as $elem)
+ echo $elem;
+
+ Good:
+ if (true) {
+ foreach($arr as $elem) {
+ echo $elem;
+ }
+ }
+* Name functions and methods using underscore_character().
+* Name classes using CamelCase()
+* Name globals and constants in ALL_CAPS (FALSE, TRUE, NULL, ACCESS_FRIENDS,
+ $CONFIG).
+* Space functions like_this($required, $optional = TRUE)
+* Space keywords and constructs like this: if (false) { ... }
+* Include variables in strings with double quotes instead of concatenating:
+ Bad:
+ echo 'Hello, ' . $name . '! How are you?';
+
+ Good:
+ echo "Hello, $name! How are you?";
+
+* Line lengths should be reasonable. If you are writing lines over 100
+ characters, please revise the code.
+* Use slash-style comments. (// and /* */)
+* Preferred no closing ?> tag at EOF. (Avoids problems with trailing
+ whitespace.)