This document will outline the standards for documentation and code in the MonkeShell project.
For the sake of simplicity and consistency, the coding standards will follow clang format. The clang format style can be found here.
If you are using vscode here is how to install the clang format extension:
1. Open Visual Studio Code:
Launch the Visual Studio Code application.
2. Access the Extensions View:
Press Ctrl+Shift+X to open the Extensions view.
3. Search for Clang-Format:
In the search bar, type "Clang-Format" and press Enter.
4. Install Clang-Format:
In the search results, find "Clang-Format" and click on the Install button. After installation, you may need to restart Visual Studio Code.
5. Set Clang-Format as Default Formatter:
After installing the extension, set Clang-Format as your default formatter.
6. Place .clang-format File:
Place your .clang-format file in the opened project directory.
7. Update settings.json:
Open your settings.json file in Visual Studio Code and add the following lines:
{
"editor.formatOnSave": true,
"clang-format.executable": "/absolute/path/to/clang-format",
"clang-format.language.cpp.style": "file"
}Variables should be named using camelCase. The name should be descriptive of the variable's purpose.
Functions should be named using camelCase. The name should be descriptive of the function's purpose. The only exception to this rule is if the function is meant to replace an existing standard library function. In this case, the function should be named the same as the standard library function but with c_ prepended to the name.
Files should be named using camelCase. The name should be descriptive of the file's purpose.
If the file is a test file, the name should be the same as the file it is testing with _test appended to the end.
Macros should be named using all caps and underscores. The name should be descriptive of the macro's purpose.
Structs should be named using camelCase. The name should be descriptive of the struct's purpose.
Enums should be named using camelCase. The name should be descriptive of the enum's purpose.
Typedefs should be named using camelCase. The name should be descriptive of the type's purpose.
Defines should be named using all caps and underscores. The name should be descriptive of the define's purpose.
The function header should be formatted as follows:
/**
* @brief A brief description of the function
*
* Details (optional): A detailed description of the function if needed
*
* @param[?in][?out] param1 A description of the first parameter
* .
* .
* .
* @param[?in][?out] paramN A description of the Nth parameter
* @return A description of the return value if there is one
*/Documentation here is not as strict as the function header. The function body should be documented as needed to explain the code. Inline comments should be used to explain any complex code or code that is not self-explanatory.
The top of every header file should be formatted as follows:
/**
* @file filename.c
* @brief A brief description of the file
* @authors
*
* Details: A detailed description of the file
*
* Assumptions/Limitations: Any assumptions or limitations of the code
*
* @date 2021-03-01
*/The top of every source file should be formatted as follows:
/**
* @file filename.c
* @authors
*
* @date
*/Makefiles simply require the author and date to be included at the top of the file.
# Author(s):
# Date: