Skip to content

Latest commit

 

History

History
27 lines (19 loc) · 1.03 KB

File metadata and controls

27 lines (19 loc) · 1.03 KB

CosmOS coding standards

  • Standard based on LLVM and defined in .clang-format in project root. Use clang-format as your code formatter, and make lint to check for errors.
  • CosmOS is spelled CosmOS
  • CosmOS uses Snake Case for function names
  • Do not include header files from /kernel/dev/. Instead, query the DeviceMgr for the appropriate device and use the abstract device API from /sys/deviceapi/

Configure your editor for code formatting

VSCode

Configure VSCode to use the cLangFormat formatter, and file for style options, which will refer to .clang-format.

In settings.json:

{
  // Coding style. Use "file" to load the style from a .clang-format file in the current or parent directory.
  'C_Cpp.clang_format_style': 'file',

  // Configures the formatting engine for clangFormat.
  'C_Cpp.formatting': 'clangFormat',

  // Format a file on save. Formatter must be available.
  'editor.formatOnSave': true,
}