5 \___|\___/|_| \_\_____|
9 To Think About When Contributing Source Code
11 This document is intended to offer some guidelines that can be useful to keep
12 in mind when you decide to write a contribution to the project. This concerns
13 new features as well as corrections to existing flaws or bugs.
17 When contributing with code, you agree to put your changes and new code under
18 the same license curl and libcurl is already using. Curl uses the MozPL, the
19 Mozilla Public License, which is *NOT* compatible with the well known GPL,
20 GNU Public License. We can never re-use sources from a GPL program in curl.
21 If you add a larger piece of code, you can opt to make that file or set of
22 files to use a different license as long as they don't enfore any changes to
23 the rest of the package and they make sense. Such "separate parts" can not be
24 GPL either (although they should use "GPL compatible" licenses).
26 Curl and libcurl will soon become dual licensed, MozPL/MITX!
30 Try using a non-confusing naming scheme for your new functions and variable
31 names. It doesn't necessarily have to mean that you should use the same as in
32 other places of the code, just that the names should be logical,
33 understandable and be named according to what they're used for.
37 Please try using the same indenting levels and bracing method as all the
38 other code already does. It makes the source code a lot easier to follow if
39 all of it is written using the same style. I don't ask you to like it, I just
40 ask you to follow the tradition! ;-)
44 Comment your source code extensively. I don't see myself as a very good
45 source commenter, but I try to become one. Commented code is quality code and
46 enables future modifications much more. Uncommented code much more risk being
47 completely replaced when someone wants to extend things, since other persons'
48 source code can get quite hard to read.
52 Keep your functions small. If they're small you avoid a lot of mistakes and
53 you don't accidentally mix up variables.
55 Non-clobbering All Over
57 When you write new functionality or fix bugs, it is important that you don't
58 fiddle all over the source files and functions. Remember that it is likely
59 that other people have done changes in the same source files as you have and
60 possibly even in the same functions. If you bring completely new
61 functionality, try writing it in a new source file. If you fix bugs, try to
62 fix one bug at a time and send them as separate patches.
64 Separate Patches Doing Different Things
66 It is annoying when you get a huge patch from someone that is said to fix 511
67 odd problems, but discussions and opinions don't agree with 510 of them - or
68 509 of them were already fixed in a different way. Then the patcher needs to
69 extract the single interesting patch from somewhere within the huge pile of
70 source, and that gives a lot of extra work. Preferably, all fixes that
71 correct different problems should be in their own patch with an attached
72 description exactly what they correct so that all patches can be selectively
73 applied by the maintainer or other interested parties.
77 Writing docs is dead boring and one of the big problems with many open source
78 projects. Someone's gotta do it. It makes it a lot easier if you submit a
79 small description of your fix or your new features with every contribution so
80 that it can be swiftly added to the package documentation.
82 Write Access to CVS Repository
84 If you are a frequent contributor, or have another good reason, you can of
85 course get write access to the CVS repository and then you'll be able to
86 check-in all your changes straight into the CVS tree instead of sending all
87 changes by mail as patches. Just ask if this is what you'd want.
91 Since the introduction of the test suite, we will get the possibility to
92 quickly verify that the main features are working as supposed to. To maintain
93 this situation and improve it, all new features and functions that are added
94 need tro be tested. Every feature that is added should get at least one valid
95 test case that verifies that it works as documented. If every submitter also
96 post a few test cases, it won't end up as a heavy burden on a single person!