summaryrefslogtreecommitdiffstats
path: root/Style Guide.txt
diff options
context:
space:
mode:
authorBluebie <a@creativepony.com>2013-12-17 12:02:35 +1100
committerBluebie <a@creativepony.com>2013-12-17 12:02:35 +1100
commit58caa36ba05e06799201ae4a088401dabdddb2c3 (patch)
tree8d46419f5811063a490cedf02a970dd2f3ce6e73 /Style Guide.txt
parentde416941068db51412566821c08ee6b11637d06c (diff)
downloadmicronucleus-58caa36ba05e06799201ae4a088401dabdddb2c3.tar.gz
micronucleus-58caa36ba05e06799201ae4a088401dabdddb2c3.tar.bz2
micronucleus-58caa36ba05e06799201ae4a088401dabdddb2c3.zip
Proposed code style guide!
Discussion happening at https://github.com/micronucleus/micronucleus/pull/32
Diffstat (limited to 'Style Guide.txt')
-rw-r--r--Style Guide.txt37
1 files changed, 37 insertions, 0 deletions
diff --git a/Style Guide.txt b/Style Guide.txt
new file mode 100644
index 0000000..2cf7311
--- /dev/null
+++ b/Style Guide.txt
@@ -0,0 +1,37 @@
+Code under /firmware/, /commandline/, /upgrade/ should be written to conform to:
+
+The UNSW Computer Science C Styleguide:
+ https://wiki.cse.unsw.edu.au/info/CoreCourses/StyleGuide
+
+With the following additions:
+- Structured Programming rules can (and are frequently) broken because this is
+ often useful in getting code to compile smaller. Returns from inside loops are
+ completely fine.
+- We use spaces for code indentation - two spaces precisely. C Code in these
+ folders should never contain tab characters.
+- Width of lines should be kept under 80 chars where practical. Function calls
+ can be split over multiple lines and have following arguments indented with
+ spaces.
+- Comments on the same line as code are bad.
+- C Preprocessor directives must always be indented with code correctly. Inside
+ a function #if's and #ifdefs are indented along with code, using spaces.
+- Specifically in firmware code, any of the rules can be broken to make code
+ compile smaller, and we don't care about polluting the global namespace with
+ global variables and stuff like that.
+- Anything in a folder called 'usbdrv' is exempt from this style guide
+ -> it follows Objective Development's V-USB style.
+ -> you probably shouldn't be changing stuff in there anyway!
+ -> our usbdrv is hacked with some stuff to handle redirecting PCINT0
+
+On use of Ruby:
+
+Micronucleus uses ruby code for some little tasks, especially to aid in testing
+and building data for /upgrade/. The stuff in /ruby/ is out of date and doesn't
+work very well for uploading programs to devices. It isn't as good at recovering
+from errors as the commandline tool. It is mainly a legacy thing.
+
+The Ruby community has a long established style and all Ruby code in this
+repository should be styled in conformance with that. We use 2-space intents.
+
+We currently write for and use Ruby 2.0, but all the code should work fine with
+Ruby 1.9.2 and above, at the time of writing. \ No newline at end of file