2.23.92
[evolution.git] / HACKING
blob7c0e9b8c4853daad6e3a1a3282237883e44da326
2 1 Patch guidelines
4 This section lists some guidelines for writing a good patch which is
5 more likely to be accepted.
7 Any new features or large scale work should first be discussed on the
8 evolution-hackers list first.  This will ensure the idea fits in the
9 direction we wish to take Evolution, and also that the effort is not
10 duplicated.  See section 3 for details on the mailing lists.
12 1.1 Patch basics
14 o The patch should apply cleanly at the time it is made.
16 o It must compile once applied.
18 o It must not generate any more compile time warnings than were
19   already there.  This may be platform dependent so simply do your
20   best.
22 o It must conform to C89/C90 (ANSI/ISO C), and build with gcc using
23   the default compile flags.
25   The primary trap is that in C99 you may define variables anywhere in
26   the code, in C89 they must be declared in a declaration block which
27   follows any block start '{'.
29   If you wish to ensure the code is C89, try the following.
31   From the gcc manual page:
32                                                            "To select
33   this standard in GCC, use one of the options `-ansi', `-std=c89' or
34    `-std=iso9899:1990'; to obtain all the diagnostics required by the
35   standard, you should also specify `-pedantic'" ...
37   You may actually have to use '-std=gnu89' if libraries have taken
38   advantage of gcc extensions and where not compiled similarly, as the
39   above options will disable all gnu extensions.
41   [FIXME: Add the same option for Forte here]
43 o It should not add any extra debug printing by default, unless the
44   patch is specifically to add extra debug printing.
46 o It should not use any gcc extensions, except where they are properly
47   checked for and not used with other compilers.  glib provides some
48   of these features as portable macros and should be used when they
49   cover the required functionality.
51 o It must include ChangeLog entries in the appropriate ChangeLog for
52   the file modified.  Use emacs, C-4-a will start a properly formatted
53   ChangeLog entry in the correct ChangeLog file automatically.
55 o If it is from a bug report, it must reference the bug number, and if
56   it isn't in the gnome bugzilla, it must reference the bug system from
57   whence it came.
59 1.1 GUI changes
61 If the change requires non-trivial user interface changes, then they
62 will have to be discussed and approved on the evolution-hackers list
63 first.  This is highly recommended before embarking on any UI work, or
64 large scale work in general.  The Gnome HIG document is the place to
65 start on any UI changes or additions.
67 1.2 Translated string changes
69 Any changes to translated strings in a stable release must be
70 discussed on the hackers list (see section 3), and/or as part of the
71 patch submission.  There must be very good reasons for changing the
72 strings in this case.
74 1.3 Coding style
76 Generally the coding style employed matches the "Linux Kernel" style,
77 that is, basically K&R style indenting with 8 space tabs.  Tabs should
78 be used rather than space characters.  Reformatting of otherwise
79 unchanged code is not acceptable.  Editors should have any automatic
80 reformatting features disabled.
82 K&R style indenting puts braces on the same line.  The opening
83 parenthesis of a function call or conditional statement should be on
84 the same line as the function.  "else" "} else" and "} else {" must
85 always occur on lines by themselves.
87 A single blank line should follow {} blocks (if not immediately
88 followed by the close of another block), and conditional statements,
89 and be used to separate logical groups of statements in the same
90 block.
92 A single blank line only should separate functions, and other
93 structures at the top level of the file (i.e. outside functions).  The
94 same rule applies to variable declarations at the start of a block.
96 An example of the most-developer-preferred formatting:
98 TheType
99 the_function (int frank)
101         int a = 1;
103         if (a == frank) {
104                 a = foo (a);
105         } else {
106                 do {
107                         a = bob (frank) + a;
108                 } until (a == frank);
110                 frank = a;
111         }
113         return (TheType) a;
116 Where there are slight stylistic differences, the style in the
117 surrounding code should be followed.
119 1.3.1 Object casts
121 You can either use C style casts, or Gtk style casts.  Note that Gtk
122 style casts can add significant execution overhead, which is not
123 adding any extra checking.  e.g. if arguments have already been
124 type-checked by preconditions.  Putting a space between a cast and a
125 variable is optional, but preferred by most of the developers.
127 1.3.2 Preconditions
129 External api entry points should have preconditions (g_return_if_fail,
130 etc), although their use varies from case to case.  Internal entry
131 points and/or when you are guaranteed the type has already been
132 checked, are unecessary.  Object initialisation and other virtual
133 method invocations are considered internal entry points.
135 1.3.3 Line lengths
137 Do not expend effort and resort to unreadable formatting merely to fit
138 any long lines into 80 column widths.  We use 8 space tabs, and
139 because of the lack of namespacing other than extending the function
140 name, many of the function and type names are too long for this to be
141 practical.  We now all uses high resolution displays, and not
142 circa-80's VT100 terminals!
144 On the other hand, lines should generally not exceed 100 characters,
145 and absolutely not exceed 160 characters.  If your tab nesting is too
146 deep you probably have a poor design that needs rethinking.
148 1.4 Design
150 This is a tricky issue to document, but the design of new code should
151 `fit' with the existing design of the relevent module.  It should at
152 the very least, be no worse.
154 Code should not cross existing abstraction boundaries or attempt
155 to remove or work around them, if required the existing design may
156 need adjustment.
158 Type and method names should follow the existing practice in the
159 surrounding code.  Method arguments should follow the same order as
160 related methods, and should use the same names for matching
161 parameters.
163 Per file, static class globals are ok, true globals may be ok, but
164 should be used sparingly.  Use 'i' for a loop variable, if that's all
165 it is, don't use 'the_current_index'.  etc.
167 If in doubt, ask on the lists.
169 2. Patch submission guidelines
171 This section outlines procedures that should be followed when
172 submitting patches for Evolution.
174 The patch must simply be attached to an appropriate, open bug on
175 bugzilla.gnome.org.
177 For discussion of the patch, or to expediate processing of the patch,
178 an email may be sent to the evolution-patches list.  See the mailing
179 lists section for more information.  You may attach patches when
180 sending to this list for discussion.
182 Any non-trival patches (patches of more than 1 or 2 changed lines in
183 more than 5 isolated locations) also require copyright assignment.
184 See http://developer.ximian.com/projects/evolution/copyright.html for
185 details.
187 If you follow the guidelines listed here, you should generally expect
188 a response within 2 working days.  If you re-send the same patch
189 repeatedly, you will more likely receive less attention.  Do not
190 re-send the same patch repeatedly.
192 2.1 Subject Lines
194 If the patch addresses a specific bug in bugzilla.gnome.org, then the
195 bug number must be included in the subject line, preferably near the
196 beginning of the subject line.  A concise summary of the bug(s) being
197 addressed, should be the remainder of the subject.
199 It is unnecessary to add "[PATCH]", "patch" or similar to the subject
200 line, unless it is being cross-posted to other non-patch lists.
202 It is absolutely unnecessary to add "please consider", "please review",
203 or "seeking review", or similar, to the subject line.  Please do not do
204 this.
206 Where the patch does not address a specific bug number, then the subject
207 line should simply be a concise summary of the problem/feature it
208 addresses.
210 In all cases the subject line should include the module(s) to which the
211 patch applies, and would generally match the component on the bug or
212 the top-level module directory (e.g. camel, mail, addressbook, use 'all'
213 for more than 3 or 4 modules).
215 2.2 Message Body
217 Patches should be attached as attachments, preferably as a single
218 diff, when possible, and the changes are related.  The diff must be in
219 unified diff format, "-up" is a suitable argument to give to "cvs
220 diff" (-p may be dropped if not supported by your diff).  If you have
221 added files, then -N should also be used, but if you are using cvs,
222 "cvs add" is needed, and requires write access to the repository.
224 If the patch does not address a specific bug, then the patch email
225 should describe which feature or problem it addresses.  If it does
226 address a specific bug, then further explanation beyond the bug
227 commentary is optional, although often convenient.
229 It would also be helpful to summarise the module to which it applies
230 in the message body.
232 In all cases you should include which branch, or branches, the patch
233 is intended to apply to.  If this is not given it will be assumed to
234 be the trunk (HEAD), and such patches will and must not be applied to
235 any stable branch without further approval.
237 2.3 Stable branches
239 Generally, any patch to the stable branch from non-core developers
240 must address a specific bug in bugzilla.gnome.org.  The patch should
241 also be attached to the bug in question.  The patch must not be
242 applied until reviewed.
244 3 Mailing lists
246 3.1 Evolution Hackers
248 If you wish to discuss patches before they are submitted, or ideas
249 before you start to work on them, do it on the evolution-hackers list,
250 which may be subscribed and viewed at
251 `http://lists.ximian.com/mailman/listinfo/evolution-hackers'.
253 This is a low-volume list (5-10 posts per day on average).
255 Some patches may be discussed here to get a wider audience, although
256 once a patch has been made it should generally be discussed on
257 evolution-patches.  Large posts are blocked, so they should be sent to
258 the patches list intsead, or reference resources elsewhere.
260 Feature requests, bug reports, and other user related discussions,
261 without the intention to write code to address them, will be ignored.
263 3.2 Evolution Patches
265 The patch discussion list evolution-patches may be subscribed and
266 viewed at
267 `http://lists.ximian.com/mailman/listinfo/evolution-patches'.  Once a
268 patch has been written, it may be submitted here for discussion, as
269 well as final approval.
271 Patches may be sent to this list as attachments for discussion.
273 Any non-patch related postings to this list will be ignored.