This is a general style guide for the Solar Car Team, individual projects can deviate from this style guide but this is for general practice. Anything not listed here is dependent on the project.
Follow AStyle, bindings are available in sublime and vim. To install the latest version in debian based operating systems:
wget 'https://s3-us-west-2.amazonaws.com/ucsolarteam.hostedfiles/astyle'
tar -zxvf astyle
cd astyle/build/gcc
make release
sudo make installTo format a file with default astyle settings:
astyle filenameTo recursively format all .cpp and .h files:
astyle "*.cpp" "*.h" -rTo use the provided astylerc options file:
astyle --options=/path/to/astylerc filenameThe astylerc file located beside this README is the official astyle options file for the UofC Solar Car Team.
To check in a script whether are files are formatted correctly:
astyle "*.h" "*.cpp" -r --dry-run --options=/path/to/astylerc | grep FormattedMember variables should have a trailing underscore.
Use gofmt, this is built into a standard go installation. It’s recommended to install an automatic gofmt in vim or sublime.
Refer to the PEP8 Style Guide