Difference between revisions of "InkBox project code contributing guidelines"
Jump to navigation
Jump to search
(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...") |
|||
Line 41: | Line 41: | ||
fi</pre> | fi</pre> | ||
== English == | == English == | ||
Check your spelling before committing. <b>Pro tip:</b> | Check your spelling before committing. | ||
* <b>Pro tip:</b> Never commit your code without testing and/or reviewing it (whichever comes first). | |||
* <b>Pro tip:</b> In English, sentences start with a capital letter and finish with a dot. | |||
== Comments == | == Comments == | ||
Comments must start with a capital letter. | Comments must start with a capital letter. | ||
== <code>clang-format</code> == | == <code>clang-format</code> == | ||
Do NOT use <code>clang-format</code>. | Do NOT use <code>clang-format</code>. |
Revision as of 16:53, 26 July 2022
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).
- Pro tip: In English, sentences start with a capital letter and finish with a dot.
Comments
Comments must start with a capital letter.
clang-format
Do NOT use clang-format
.