OF code style with CB's AStylePlugin

When writing OF apps, I would like to adhere as much as possible to the preferred OF code style as decribed in the GitHub Wiki: oF code style. It would be great to have source code formatting using this code style as well. I am currently using CB as my IDE of choice for OF. The GitHub Wiki: openFrameworks Coding style guidelines mentions CB’s AStylePlugin. Indeed it’s very easy to run this plugin from within CB with just two mouse-clicks. However, when this plugin is used, the source code is not formatted in the OF style.

In CB the source code formatter settings can be found under Settings > Editor > Source Formatter. There are three tabs (see the three attached images below). I’ve searched the forums of OF, CB and AStyle, but I can not find the AStyle settings that would format source code according to the OF code style (as much as possible). Does anyone have suggestions for the settings in these tabs to match the OF coding style?




1 Like

Astyle was in fact just a suggestion, and nobody as of now has created an astyle config file.
The “canonical” style config file is for the tool “uncrustify” (don’t know if you can use that on CB, too?), and can be found here.

Ok, thanks! I’ve researched this some more. It seems that the AStylePlugin doesn’t support a config file. However, given it’s limited configurability, it probably wouldn’t have been able to adhere fully to the OF coding style anyway.

I’ve looked into your other suggestion of using Uncrustify in CB and got that working, so now I can use the official config file! I’ve posted a step-by-step guide to setting up and using Uncrustify in CB here.

nice, thank you very much, I’ll include a link in the GH wiki page.