[gnome-love] Coding style



One of the most common changes that maintainers ask for when receiving
patches has to do with coding style. It takes a couple of round trips
from maintainer to contributor for the maintiner to teach him the
correct coding style for the project. 

At first it might not seem obvious to a gnome-lover why are the
maintainers so picky with such a small issue. Coding style is very
important when you have different hackers working on the same code
specially on large scale project. It is is more important to follow a
stric coding style than which coding style to use.

Different GNOME projects have different coding styles but most of the
core GNOME components follow what is known as "GNOME's coding style".
Before sending a patch to a maintainer i would recommend that you make
sure the coding style of the patch matches the one of the project. In
the time i've been contributing to GNOME i've seen a lot of resources
lost to this cause, so if new contributors can do a good job on their
own, it will lessen the work of maintainers.

The following indent line creates the coding style uses in most of the
core GNOME projects :

indent -kr -i8 -pcs -lps -psl *.c

(see "man indent" if you want to know what each options does)

This line will modify the .c files to comply with the coding style
specified with the parameters. I don't recommend coding in a different
style and then running indent on the code to conform to the correct
style because indent will modify some other parts of the code that we
might not want to change, use this only as a guide and run diffs on your
code before & after running indent.

So the next time you sumbmit a patch i recommend that you run the
appropiate indent command for that project too identify any changes on
the code that you might need to do.

love,
Chema





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]