Solidifying our workflow

These past few days we’ve worked (among other things) on improving our workflow to write clean code and have a clean git repository.

It all started when Alexis was horrified by seeing my code indented by tabs, and other monstrosities. Following Alexis advice, we decided to start using an automatic code formatting tool, and we also figured it would be nice to write down some norms for our general coding / commenting style.

We settled on clang-format for the code formatting tool, as it seems to be the standard. We tried using the LLVM default style, and were quite annoyed at first at some of the formatting. For instance, clang-format was replacing this:

while(something);

By this:

while(something)
  ;

Anyway, we’ll try to get used to it.

There were several options on how to use clang-format:

  • Use a client side git hook to automatically format the code at each commit
  • Do the same thing with a server side git hook triggered at each push
  • Integrate clang-format to our code editors

I started reading on low level git plumbing functions to have a good comprehension of how git hook scripts are written, but eventually we settled on the third option, which was quite simple.

I then wrote a wiki page on our gitlab repository where I clearly explained our git workflow (a slightly simpler version than gitflow), how we handle .gitignores, our commit message style, how we comment our code, etc…

Most of this had already been decided and was already written somewhere but it was nice to have written all clearly in one place.

Leave a Reply

Your email address will not be published. Required fields are marked *