diff options
author | Donovan Baarda <abo@minkirri.apana.org.au> | 2018-02-23 15:58:43 +1100 |
---|---|---|
committer | Donovan Baarda <abo@minkirri.apana.org.au> | 2018-02-23 15:58:43 +1100 |
commit | 92207b458cad6f0b98559e2a9b7df510b431d788 (patch) | |
tree | 65902272fde82293d795cd5fd14a82fb60d4d782 | |
parent | cc0e89b8b26ba1c2a7c5eaf9b2c0bbad056b9764 (diff) | |
download | librsync-92207b458cad6f0b98559e2a9b7df510b431d788.tar.gz |
Update CONTRIBUTING.md with coding style information.
-rw-r--r-- | CONTRIBUTING.md | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3596af3..bb3cd9a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,6 +3,71 @@ Instructions and conventions for people wanting to work on librsync. Please consider these guidelines even if you're doing your own fork. +## Code Style + +The prefered style for code is equivalent to using GNU indent with the +following arguments; + +```Shell +$ indent -linux -nut -i4 -ppi2 -l80 -lc80 -fc1 -fca -sob +``` + +The preferred style for non-docbook comments are as follows; + +```C + + \*= + | A short poem that + | shall never ever be + | reformated or reindented + */ + + \* Single line comment indented to match code indenting. */ + + \* Blank line delimited paragraph multi-line comments. + + Without leading stars, or blank line comment delimiters. */ + + int a; /* code line comments */ +``` + +The preferred style for docbook comments is javadoc with autobrief as +follows; + +```C +\** \file file.c Brief summary paragraph. + * + * With blank line paragraph delimiters and leading stars. + * + * \param foo parameter descriptions... + * + * \param bar ...in separate blank-line delimited paragraphs. + * + * Example:\code + * code blocks that will never be reformated. + * \endcode + * + * Without blank-line comment delimiters. */ + + int a; /**< brief attribute description */ + int b; /**< multiline attribute description + * + * With blank line delimited paragraphs.*/ +``` + +There is a `make tidy` target that will use GNU indent to reformat all +code and non-docbook comments, doing some pre/post processing with sed +to handle some corner cases indent doesn't handle well. + +There is also a `make tidyc` target that will reformat all code and +comments with https://github.com/dbaarda/tidyc. This will also +correctly reformat all docbook comments, equivalent to running tidyc +with the following arguments; + +```Shell +$ tidyc -R -C -l80 +``` + ## Pull requests Fixes or improvements in pull requests are welcome. Please: |