← Back to team overview

elementary-dev-community team mailing list archive

Coding Style parentheses exception

 

Hey there guys, attached is the elementary OS coding style (We have this on
a Google Doc, but the formatting is broken on it, so I'm rewriting it with
Writer to then port to Google Docs again).

I want to add an exception regarding the space character before opening
parentheses, and I want to know if you all agree:

  Usually, we put a space character before opening parentheses:

     public string get_text () {}

     if (a == 5) return 4;

     for (i = 0; i < maximum; i++) {}

     my_function_name ();

     Object my_instance = new Object ();

  However, if we have something like this:

         if ((e.state & Gdk.ModifierType.MOD1_MASK) != 0) {

 Before the second opening parentheses on that line, I didn't put a space
character because I think it looks quite bad. Do you guys agree that when
we have 2 parentheses in a row we should not put a space character before
the second one?


         if ( (e.state & Gdk.ModifierType.MOD1_MASK) != 0) {

  That's how it would look like.


Thank youg uys.

Attachment: elementaryos_coding_style.odt
Description: application/vnd.oasis.opendocument.text


Follow ups