codestyle/style guide

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
LeFix
Posts: 7
Joined: Sat Jul 24, 2021 9:44 am

codestyle/style guide

Post by LeFix »

Is there no preferenced codestyle/formatting?

I searched in the forum and the wiki and the only thing I found is from 2011 https://forum.freecadweb.org/viewtopic.php?f=10&t=837

I expected at least one hit when searching "codestyle", "style guide" or something like "clang-format"...

At which point there's some style enforced, during the pull request?
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: codestyle/style guide

Post by openBrain »

Generally I tend to try applying the same style as the file(s) I'm modifying. ;)
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: codestyle/style guide

Post by Kunda1 »

Each workbench has it's variations, for example:
FEM workbench https://github.com/FreeCAD/FreeCAD/blob ... entions.md
Draft and Arch https://github.com/FreeCAD/FreeCAD/blob ... entions.md
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
chennes
Veteran
Posts: 3884
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: codestyle/style guide

Post by chennes »

It comes up from time to time, but the basic preference here seems to be to not worry too much about it, and to let devs focus on developing — we’ve probably all seen in other projects how discussions about style turn into bikeshedding pretty quickly. That said, our C++ more or less follows the Qt style guide here: https://wiki.qt.io/Qt_Coding_Style
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
Post Reply