Draft coding conventions
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Draft coding conventions
I noticed FEM has a nice coding convention file.
What about if we copy it in the main Draft module folder and adapt it to our needs? @vocx
so we can slowly port the code to be consistent to it...
What about if we copy it in the main Draft module folder and adapt it to our needs? @vocx
so we can slowly port the code to be consistent to it...
follow my experiments on BIM modelling for architecture design
Re: Draft coding conventions
would be cool if there would be not that much difference
Re: Draft coding conventions
i meant to just change the module name
follow my experiments on BIM modelling for architecture design
Re: Draft coding conventions
Yes. Since Bernd uploaded his initial coding conventions, I copied the file to my computer and changed a few things to refer to Draft specifically; then I expected to make a pull request. But since Bernd continued adding to the coding conventions, I decided to wait until there were no more changes. This means Bernd does all the work and we just adapt it quickly.
It was not a priority because anyway not many people are contributing to Draft/Arch, and Yorik and I mostly comply with PEP8 conventions already.
When I started changing some stuff Bernd opened a thread to discuss this, where I mentioned some of the things that I was doing, Python codeformating Draft, Arch in the regard of pep8 etc.
I was mostly trying to fix the formatting of several Draft files, and provide documentation strings. In fact, my emphasis was on the documentation strings, and not the formatting itself, but that was done as well when no major changes were needed.
As per my different threads I am trying to improve the PEP8 style of Draft (see the links in Python) but this requires some work to avoid breaking previous code. For example, in the case of snake_case, I want to provide new snake_case_commands, and then aliases to the old names that use CamelCase; then the old code doesn't break. See Draft.py in pull request #2830 for how this should work.
The only thing I basically disagree with Bernd is the use of "black" to format Python. I hate that "black". It looks hideous.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Re: Draft coding conventions
ATM there is not code in FEM which uses FEM.
But yes the only difference we have are the line breaks. I have started to use line breaks the way black does it (only use one tab (4 spaces) for indent) and you prefere to use line breakes another way use as many tabs (x4 spaces) as the code before is long. I do not know how to describe these systems in short.
Re: Draft coding conventions
Blackbernd wrote: ↑Tue Jan 07, 2020 5:32 am ...
But yes the only difference we have are the line breaks. I have started to use line breaks the way black does it (only use one tab (4 spaces) for indent) and you prefere to use line breakes another way use as many tabs (x4 spaces) as the code before is long. I do not know how to describe these systems in short.
Code: Select all
mostly_affects_parentheses(with, some,
hideous, results
):
Best Python style
Code: Select all
best_alignment_of_parentheses(with, neat,
lines, aligned, to,
previous, line):
Code: Select all
function_has_no_arguments(
):
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Re: Draft coding conventions
FreeCAD FEMvocx wrote: ↑Tue Jan 07, 2020 5:53 am ...
Black...Code: Select all
mostly_affects_parentheses(with, some, hideous, results ):
Code: Select all
mostly_affects_parentheses(
with, some, structured, results
):
Code: Select all
mostly_affects_parentheses(
with,
some,
structured,
results
):
Re: Draft coding conventions
Pull request #3191.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.