-
-
Notifications
You must be signed in to change notification settings - Fork 13
InkBox project code contributing guidelines
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.
- If the repository you are working on is a fork, please ensure that it is up-to-date with upstream before making changes.
- Make sure that no build artifacts are staged for a commit it
before it's too late.
.gitignore
is your friend.
One indent must be equivalent to 4 spaces or one tabulation.
Files must contain an empty newline at the end. If you are using Visual Studio Code, enable this: https://stackoverflow.com/questions/44704968/visual-studio-code-insert-newline-at-the-end-of-files/44704969#44704969
Check your spelling before committing.
- Pro tip: Never commit your code without testing and reviewing it (whichever comes first).
- Pro tip: In English, sentences start with a capital letter and finish with a period.
Comments must start with a capital letter.
When using clang-format ensure that you are using the .clang-format
file in the root directory of the project to set the style.
- No unnecessary includes
- One-line comments:
// Hi, this is a comment
- Multi-line comments:
/*
Hi, this is a
multi-line comment
*/
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(thing) {
do_thing();
}
else {
do_other_thing();
}
Use camelCase
in C++. This applies also if you are inserting C into
C++ code.
Use UpperCamelCase
(aka PascalCase
) for class names.
if(thing) {
doThing();
}
else {
doOtherThing();
}
Use snake_case
or CAPITAL_SNAKE_CASE
.
* Variables must be declared like this: var="test"
. For integer
variables, they must be declared like this: var=0
.
- Variables must be accessed like this:
echo "${var}"
. For integer variables, they may be accessed like this:echo ${var}
. - Files names in variables must be put in double quotes, like this:
if [ -f "${file}" ]; then
if [ "${var}" == "test" ]; then
do_thing
else
do_other_thing
fi
Use PascalCase
.