-
Notifications
You must be signed in to change notification settings - Fork 833
2.4 Coding style
In general, try to stick with the style you find in existing files. Fritzing follows the Qt Coding style in most cases, but there are some differences.
The Fritzing source code has a mix of 4-spaces and tabs. To render properly, set your tab width to 4. For example, to set the tab width in git diffs: git config --global core.pager 'less -x1,5'
Preferably configure your editor to use tabs for C++ code, but do not reformat whole files.
Use curly braces for single line if or for statements. For example
if ( condition ) {
if ( other ) {
a += 1;
}
}
This is not in line with qt style, but we think it is important to distinguish from
if ( condition ) a = 1;
if ( other )
a += 1;
Especially since we have a mix of 4 spaces and tabs.
It is ok to occasionally use 120 columns before breaking a line, so you are not forced to split calls like varWithToLongName->callToMethodWithAnotherLongName(justThisParameter, andAnotherOne)
This is not an invitation to create deeply nested conditional clauses!
For everything else, please see Qt Coding Style and Qt Coding Conventions
If in doubt, don't hesitate to ask.
COPYRIGHT FRITZING.ORG ALL RIGHTS RESERVED