From 5013227db1c77f163640f27cde3c0e785e110177 Mon Sep 17 00:00:00 2001 From: Victor Lopez Date: Mon, 10 Jul 2017 16:07:48 +0200 Subject: [PATCH] Add Contribution guide --- CONTRIBUTING.md | 18 +++++++++++++ doc/guides/coding-guidelines.md | 46 +++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 CONTRIBUTING.md create mode 100644 doc/guides/coding-guidelines.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..12e1733d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,18 @@ +# Contributing Guide + +## Issue contributions +For either questions or bugs, submit a ticket for your issue, assuming one does +not already exist. Try to: + +* Describe the issue including steps to reproduce when it is a bug. +* Make sure you fill in the version that you are using. + +## Code contributions +If you want to contribute, fork this project and make a pull request. Try to: + +* Write tests. +* Follow our [coding guidelines][coding]. +* Write a [good commit message][commit]. + +[coding]: doc/guides/coding-guidelines.md +[commit]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html diff --git a/doc/guides/coding-guidelines.md b/doc/guides/coding-guidelines.md new file mode 100644 index 00000000..660ca901 --- /dev/null +++ b/doc/guides/coding-guidelines.md @@ -0,0 +1,46 @@ +# Coding guidelines + +## Names +1. Use *DLB_PascalCase* for C interface function names. +1. Use *snake_case* for function names. +1. Use *snake_case* for local variables. +1. Use *UPPER_CASE* for enum values. +1. Use whole words in names when possible. + +## Style +1. Use 4 spaces per indentation. +1. Braces should start on the same line as the statement. +1. Always surround loop and conditional bodies with curly braces. + Statements on the same line are allowed to omit braces. +1. Type names should (in general) be defined inside the scope that uses them. +1. Error condition should be reported through return enum mechanism. + +## Functions +1. Use static functions when possible. +1. Do not export a symbol name if it does not belong to the interface. + +## Documentation +1. Use doxygen to document all functions that belong to the interface. + * A brief summary (one sentence) declaring the function main purpose + (mandatory). + * A list of parameters (with its type [in], [out] or [in,out]) including a + short description (mandatory, if any). + * The returning value of the function (mandatory, if non-void). + * A more detailed function description (when needed). + * A doxygen example: + + ```c + /*! \brief Brief function description + *! \param[type] param1 Param 1 description + *! \param[type] param2 Param 2 description + *! \return Return value description + */ + int DLB_Function(type1_t param1, type2_t, param2) { + ... + } + ``` + +## License +1. All files (sources, headers, scripts, ...) MUST have the proper license +header +