Code Style Guide
This document provides the coding style guidelines for this codebase, which includes C++, Python, Rust, Java, and shell scripts. Adhering to consistent coding standards across the codebase promotes maintainability, readability, and code quality.
C++ Style
We follow the Google C++ Style Guide for coding standards in C++.
Python Style
We follow the black code style for Python coding standards.
Style Linter and Checker
We use different linters and checkers for each language to enforce code style rules:
- C++: clang-format-8 and cpplint
- Python: Flake8
Each linter can be included in the build process to ensure that the code adheres to the style guide. Below are the commands to check the code style in each language:
For C++, format and lint the code by the MakeFile command:
# format
$ make neug_clformatFor Python:
- Install dependencies first:
$ pushd tools/python_bind
$ pip3 install -r requirements_dev.txt
$ popd- Check the style:
$ pushd tools/python_bind
$ python3 -m isort --check --diff .
$ python3 -m black --check --diff .
$ python3 -m flake8 .
$ popd
$ pushd tools/shell
$ python3 -m isort --check --diff .
$ python3 -m black --check --diff .
$ python3 -m flake8 .
$ popd