CodingStyle
All code submitted should follow a few simple rules. These are a useful guide to existing developers, as well as advice to anyone submitting new code in the form of a patch. (This information was originally taken from the file HACKING in alexandria/trunk/alexandria/doc)
Indentation
Use 2 spaces for indentation. (Alexandria used to use 4-space indentation, but the 2-space style is pretty much ubiquitous in Ruby code, so we’re now using that instead.)
- Vim users can use
set ts=2andset et. You can also useset smarttabso that backspace on a 2-space sequence at the beginning of a line will backspace 2 spaces. - For Emacs users,
ruby-modealready uses 2 spaces for indentation by default.
Blocks
- For code blocks: use
{ ... }when the block will fit on a single line; otherwise usedo ... end. However, remember that brace-defined blocks have a higher precedence than do-defined blocks and may behave differently in some circumstances.
User-interface
- When accessing properties of Ruby-GNOME2 objects, always prefer the form
foo=toset_foo - When working on the user interface, make sure your changes don’t break the GNOME Human Interface Guidelines (also known as the HIG). Alexandria doesn’t strictly follow the HIG at the moment, but we aim to.
Patches
- Ideally, you should code on a checked-out version of SVN Alexandria and provide patches generated with the command
svn difffrom the alexandria directory. (By default, subversion generates unified diffs.) Also include a description of your changes or additions which can be put into the commit message.


RSS feeds