InkBox project code contributing guidelines
Revision as of 16:41, 26 July 2022 by Nicolas Mailloux (talk | contribs) (Created page with "This page contains code contributing guidelines one must follow for their code to be merged in one of the source repositories of the InkBox project. When writing code, you shall remember one word: <b>consistency</b>. == C/C++ == * No unnecessary includes * One-line comments: <pre>// Hi, this is a comment</pre> * Multi-line comments: <pre>→Hi, this is a multi-line comment: </pre> === C === ==== Variables and function names ==== Use <code>snake_case</code> when...")
This page contains code contributing guidelines one must follow for their code to be merged in one of the source repositories of the InkBox project. When writing code, you shall remember one word: consistency.
C/C++
- No unnecessary includes
- One-line comments:
// Hi, this is a comment
- Multi-line comments:
/* Hi, this is a multi-line comment */
C
Variables and function names
Use snake_case
when programming in C. This doesn't apply if you are inserting C code into a C++ project. In this case, follow only the C++ guidelines.
if
conditions
if(thing) { do_thing(); } else { do_other_thing(); }
C++
Variables and function names
Use camelCase
in C++. This applies also if you are inserting C into C++ code.
if
conditions
if(thing) { doThing(); } else { doOtherThing(); }
Bourne-Again SHell (bash) and similar
Variables and function names
Use snake_case
or CAPITAL_SNAKE_CASE
.
- Variables must be declared like this:
var="test"
- Variables must be accessed like this:
echo "${var}"
if
conditions
if [ "${var}" == "test" ]; then do_thing else do_other_thing fi
English
Check your spelling before committing. Pro tip: never commit your code without testing and/or reviewing it (whichever comes first).
Comments
Comments must start with a capital letter.
clang-format
Do NOT use clang-format
.