mirror of
https://github.com/elementary/gala.git
synced 2024-12-24 17:53:19 +03:00
Copy code style rules from plank's HACKING file
This commit is contained in:
parent
80afa860d4
commit
79939170ce
39
HACKING
39
HACKING
@ -3,6 +3,7 @@
|
||||
====== Testing the latest build ======
|
||||
|
||||
Get daily builds on Launchpad for Ubuntu 12.04 and later.
|
||||
|
||||
https://launchpad.net/~elementary-os/+archive/daily
|
||||
|
||||
====== Join IRC chat rooms ======
|
||||
@ -126,21 +127,35 @@ Be sure to understand this, and avoid a headache later!
|
||||
|
||||
====== Coding style ======
|
||||
|
||||
Gala's source code in general follows the elementary Code Style.
|
||||
In fact, you can read more about it here:
|
||||
Gala's source code in general follows the K&R "One True Brace Style" (1TBS),
|
||||
with a caveat: spaces are inserted before opening parenthesis.
|
||||
|
||||
For indenting the source code only tabs are used!
|
||||
Tabs should be 4 spaces wide for code to look good.
|
||||
|
||||
Consider the following snippet as an example:
|
||||
|
||||
int test_check ()
|
||||
{
|
||||
if (x < 0) {
|
||||
message ("Negative");
|
||||
negative (x);
|
||||
} else {
|
||||
message ("Non-negative");
|
||||
nonnegative (x);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Of course the best example is the current source code itself.
|
||||
|
||||
You can also have a look at this doc for some parts:
|
||||
|
||||
http://elementaryos.org/docs/code/code-style
|
||||
|
||||
NOTE: we don't use 4 spaces, but tabs instead. Also the position for curly
|
||||
brackets for declarations differs from the docs, you place the first one
|
||||
on a new line:
|
||||
|
||||
class MyClass
|
||||
{
|
||||
public void my_method ()
|
||||
{
|
||||
}
|
||||
}
|
||||
Keep in mind that neither the indentation rules or curly
|
||||
bracket positions mentioned there apply for Gala.
|
||||
|
||||
====== Committing code ======
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user