Skip to content

Coding Standards

Lauren Greenhill edited this page Jun 25, 2022 · 5 revisions

Editing Github Action for Code Formatting Check

Upon code push/pull request, Github will automatically check if the code complies with the Clang format. If not, a failure message would occur. The check is for hpp/cpp files under the src folder only.

In order to make the code pass, make sure autoformatting is set up properly in VS Code:

  • Search "settings" and select Preferences: Open Settings (JSON)
  • Enter the following in the settings JSON and save

{ "C_Cpp.clang_format_style": "file", "editor.formatOnSave": true, }

If the autoformat github action fails upon push despite the above settings, install clang-format by using pip3 install clang-format==13 and then run clang-format -i ./src/*.cpp ./src/*.hpp ./src/**/*.cpp ./src/**/*.hpp in terminal to manually autoformat the source files and retry pushing the code.

Clone this wiki locally