-
Notifications
You must be signed in to change notification settings - Fork 5
Coding Standards
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.
All changes on main must be merged into local branches.
git checkout main
git pull
git checkout your_branch
git merge main
git push
Once reviewers have approved your code, merge into main locally and check it compiles before merging on Github
git checkout main
git pull
git checkout your_branch
git merge main
git push
Check that your code compiles
Then, go to your approved pull request on Github, and click merge to main.
Finally, delete the branch you were working on.