User Tools

Site Tools


B3 Coding Conventions

Here's where we come to decide on how to - uniform- our coding.

The base of all our decisions should be this document:

Let's first take our time and read the document, and the discussion will come naturally.


.py files : no tabs, 4 spaces per indentation level
.xml files: tabs

Documenting the code

We use Doxygen to create a code reference. Check out how we document our code so it makes good documentation.


Setting up git to handle newline endings properly.

The goal is to make sure that all our newline endings are the same, goal is to have all LF endings in our repo's at github, and when working on a windows machine to all have CRLF when working locally. This procedure will make it so that your git client will convert all outgoing (push) code to LF, and all incoming (pull, fetch, merge) code to your OS specific newline endings. This way we will all merge from code with LF and our repos's will be in sync.

Open a Git Bash in your B3 repo. Type:

$ git config –global core.autocrlf true

This will enable auto newline converting for your git working copy on a windows rig.

I had to wipe out my repo and make sure I was working on my windows rig with all CRLF newline endings. Here's how I did it (make sure you backup the complete local working copy before you proceed, if it fails you can revert to your backup.):

$ git rm –cached -r . $ git diff –cached –name-only -z | xargs -0 git add $ git ls-files -z | xargs -0 rm $ git checkout .

This will refresh your local working copy and you're good to go. Now let's hope this works since I just did this a minute ago and don't have proof it actually works ;) Mar 28


Is it possible to set up notepad++ etc to autoformat? (it is fairly similar to what we use at work but still )

in the notepad++ preferences, you can define what indent style to use per language. So you can set that xml files will use the 'tab' character for indent while python scripts will use '4 spaces'.

Also in the 'edit' menu there is a tool to convert end of line style. On the toolbar there is also a button (the paragraphe symbol) which will make end of line characters and indent characters visible to the human eye.

Page Tools