Skip to content

Formatting Cpp and Python code

Sami19944 edited this page Dec 13, 2018 · 3 revisions

This project contains git hooks and formating scripts to make formating code easy.

Setup

This project uses autopep8 for automatic code formatting. Before you first use it, you need to install it like this:

sudo apt-get install python-pip
pip install --upgrade autopep8

Git Hooks

A git hook is a script that executes as soon as any changes are commited with git.

To install the repos git hooks run

scripts/hooks/_install.sh

This will automaticly format C++ and Python code when a commit happens.

Format C++ and Python code manually

To format all C++ and Python code in the project just run this script

./scripts/format/format-src.sh

The python code is formatted with autopep8. It is currently configured with the aggressive flags. Thus, you need to review the changes it made.