Skip to content
Newer
Older
100644 62 lines (43 sloc) 2.67 KB
547f4a3 Cleaned up a bunch of files, added a codestyle validator and some inf…
cjdelisle authored Feb 15, 2012
1 Patches are very much welcome!
2 ==============================
3
4 If you want to get a change included in cjdns, the best thing to do is start by asking in IRC
5 if the change fits the spirit of the project, then developing your change in your own git tree
6 and then asking for it to be merged in with the others.
7
8 Small patches are easy to include and large ones are hard to validate. Consider breaking your evil
9 plans up into a bunch of nice little changes which are easy to understand and prove safe.
10
11
12 Codestyle:
13 ----------
14
15 * Indentation: 4 spaces, tabs are not in the codebase.
16 * Trailing whitespace is not in the codebase, Windows users make sure you have git configured to
17 remove carrage return characters as lines in the codebase are \n deliniated.
18 * File names and structures are CamelCase with first letter capital.
19 * All globally visible functions shall begin with the name of the file in which they are defined
f16d330 Update HACKING.md
Caleb James DeLisle authored Feb 15, 2012
20 followed by an underscore and then the name of the function. AKA `ThingThatDoesStuff_doStuff()`
547f4a3 Cleaned up a bunch of files, added a codestyle validator and some inf…
cjdelisle authored Feb 15, 2012
21 * Functions and local variables shall use camelCase names with first letter lowercase.
22 * Structures declared in header files must begin with, or be, the name of the header in which they
23 are declared.
24 * Global variables as well as static local variables are forbidden. Constants are acceptable.
25 * All preprocessor definitions in header files must contain the name of the header file followed
f16d330 Update HACKING.md
Caleb James DeLisle authored Feb 15, 2012
26 by an underscore and the definition name in all capitals AKA `define SillyMath_VALUE_OF_PI 3`
27 or `#define SillyMath_DIVIDE(a,b) (a / b)` it is sometimes acceptable for macros to use camel case
28 as is done in Endian.h, use judgement.
547f4a3 Cleaned up a bunch of files, added a codestyle validator and some inf…
cjdelisle authored Feb 15, 2012
29
30
31 If there is a better way, come to irc and announce it,
32 this code style has evolved to where it is now.
33
34
35 checkfiles.pl
36 -------------
37
38 There is a simple perl script in /scripts/ which will look out for some of the easy mistakes
39 in code style, to invoke it use:
40
41 find ./ -name '*.c' | perl ./scripts/checkfiles.pl
42 find ./ -name '*.h' | perl ./scripts/checkfiles.pl
43
44 There should be no output, most importantly, your change should not introduce any new output.
45 If there is a line which it complains about and you really need it that way, add a trailing
46 comment with:
47
48 // CHECKFILES_IGNORE
49
50 as is done in Crypto.c
51
52
53 Testing
54 -------
55
56 Any file in a /test/ subdirectory which ends with _test.c will be compiled as a test and added
57 to the testing regime through some cmake hackery. you might have to cmake .. again before typing
58 make. Tests can fail by returning non-zero or using assert statements, whatever makes sense.
59 Tests are exempt from most code style rules and checkfiles.pl is much easier on them.
60
f16d330 Update HACKING.md
Caleb James DeLisle authored Feb 15, 2012
61 *All patches which add tests will be addressed before any patches which don't.*
Something went wrong with that request. Please try again.