[or-cvs] [metrics-web/master 2/4] Add a HACKING document with some notes on code style.

karsten at torproject.org karsten at torproject.org
Thu Dec 16 07:42:26 UTC 2010


Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Sun, 12 Dec 2010 13:09:40 +0100
Subject: Add a HACKING document with some notes on code style.
Commit: 2d1c3de81f62508354fda6be37297e9c018c0fd2

---
 HACKING |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
 create mode 100644 HACKING

diff --git a/HACKING b/HACKING
new file mode 100644
index 0000000..1a05f41
--- /dev/null
+++ b/HACKING
@@ -0,0 +1,27 @@
+Some notes on code style:
+
+General:
+- Lines do not exceed 74 characters unless things become really ugly.
+- Files end with two newlines.
+
+Java code:
+- Indentation is two spaces in general and four spaces for continued lines.
+- Imports are ordered alphabetically. Imports with different top-level
+  package names or libraries (java, javax, org) are separated by an
+  additional newline.
+- Don't catch Exception, but the specific exceptions that can be thrown
+  and that you can handle. Don't catch RuntimeException at all, but fix
+  the code so that it doesn't throw RuntimeExceptions.
+- Write comments as full sentences as in /* This is a comment. */
+- Don't write your own util classes. Make use of Apache Commons instead.
+- Qualify instance attributes and instance methods using this.
+
+SQL code:
+- All SQL keywords and PostgreSQL functions are written in capital
+  letters.
+- Never execute a query with SELECT * and expect the result columns to be
+  in a specific order.
+
+R:
+- Add a space before and after '='.
+
-- 
1.7.1




More information about the tor-commits mailing list