Skip to content

Code Style

Quintin edited this page Jun 8, 2022 · 14 revisions

C++

  • Use clang-format before committing. Read this for VSCode and for CLion it should work automatically by detecting the .clang-format file.
  • Never use raw pointers, prefer std::shared_ptr etc.
  • Check if something exists in the standard library before you reinvent the wheel!
  • Prefer static_cast etc. instead of C style cast
  • Use auto on iterator types (ranged for) and when the type is obvious, for example casting or std::make_shared

Python

  • Currently pycodestyle, flake8, and isort are used as a basic check. Read this for VSCode, ideally you adhere to pylint too but it can be very strict so right now it wont be enforced.
  • If you are writing a function, please use type hinting for the signature. For other places, only use if necessary, for example a situation where the types are confusing.
Clone this wiki locally