Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add coding style document

Peter van der Does585c53b1a1f1
diff --git a/docs/codingstyle.rst b/docs/codingstyle.rst
new file mode 100644
index 000000000..c3df17076
--- /dev/null
+++ b/docs/codingstyle.rst
@@ -0,0 +1,39 @@
+.. _codingstyle:
+
+Coding Style Guide
+==================
+
+Python
+------
+
+* Code according to PEP8
+
+ Check that the code is structured as per pep8 but with a maximum line
+ length of 100.
+
+* Code for Python 3
+
+ While the application should remain compatible with python2, use django's
+ suggestion to mantain sanity: code for py3 and treat py2 as a backwards
+ compatibility requirement. If you need, you can use six.
+
+
+Javascript
+----------
+
+* Follow AirBnB ES5 style guide, with the following changes:
+
+ * Disallow named function expressions, except in recursive functions, where a name is needed.
+ * Console logging is allowed
+
+* Functions called from Django templates need to start with ``wger``
+
+
+Check Coding Style
+==================
+
+The coding style is automatically check by Travis-CI. To manually check your
+files you can run the following commands:
+
+* Pyhton: ``pep8 wger``
+* Javascript: ``gulp lint-js``