Here is a Clang-Format config to respect EPITA coding style (most of it).
- Install Clang Format
- Drop it to your home dir
- Install a plugin to link it in you favourite Ide (vim-clang-format | Sublime Clang Format)
find . -iname *.h -o -iname *.c | xargs clang-format -i
Clang-Format is not perfect and some errors might remain. To solve this started working on a moulinette to display remaining coding style errors.
First install the moulinette
mkdir ~/.scripts
cp <path-to-repo>/moulinette.py ~/.scripts
And then add the following line to your bash config (.bashrc of .bash_profile)
alias moulinette='python3 ~/.scripts/moulinette.py'
If the error is caused by a bad formatting of clang format such as:
int arr[10] = {0};
Instead of:
int arr[10] =
{
0
};
Then, you have to disable clang-format on that specific portion of code as follow:
// clang-format off
int arr[10] =
{
0
};
// clang-format on
For other errors such as "More than 10 functions in file. (8.9)", you'll have to fix them on your own.
If you find any error on the moulinette and/or want to upgrade it or if you find new useful clang-format commands don't hesitate to notify me or make a pull request.
When adding a new line of config, please add a comment to breifly explain what the line does.
Also add the coding style corresponding number to keep track of implemented features.
Documentation on Clang-Format can be found here