Review criteria

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
User avatar
shoogen
Veteran
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Review criteria

Post by shoogen »

Hi would like to suggest to put up some criteria, to reject merge request.
1. Python syntax and indention errors prohibit the pre-compilation and installation with some package managers.
Changed python code should be tested using the compileall module and possibly rejected.
http://pymotw.com/2/compileall/
https://docs.python.org/2/library/compileall.html
2. Any code that catches the Base exception class without re-throwing the exact same exception objects, needs to be hold for additional assessment.
issue #1701catch
issue #1700raise
wmayer
Founder
Posts: 20307
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Review criteria

Post by wmayer »

Code: Select all

python -m compileall -f .
gives
Compiling .\Mod\Import\automotive_design.py ...
SyntaxError: ('invalid syntax', ('.\\Mod\\Import\\automotive_design.py', 2353, 54, '\t\teval_wr1_wr = ((SIZEOF(self.self.styles) == 1) XOR (SIZEOF(None) == 0))\n'))

Compiling .\Mod\Import\ifc2x3.py ...
SyntaxError: ('invalid syntax', ('.\\Mod\\Import\\ifc2x3.py', 8809, 44, '\t\teval_wr5_wr = ( not (EXISTS(self.axis) XOR EXISTS(self.refdirection)))\n'))

Compiling .\Mod\Import\ifc4.py ...
SyntaxError: ('invalid syntax', ('.\\Mod\\Import\\ifc4.py', 10588, 63, '\t\teval_axisandrefdirprovision_wr = ( not (EXISTS(self.axis) XOR EXISTS(self.refdirection)))\n'))
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Review criteria

Post by yorik »

Interesting, I didn't know that tool! Good find! Yes, let's start using it from now on

These ifc*.py files seem autogenerated by some tool... It's annoying that they contain syntax errors
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Review criteria

Post by jriegel »

Yes, thats a beta generator of the SCL (Step Class Library). It was intended to use them as high level parser for all kind of STEP files. But so far they are just dead code...
Stop whining - start coding!
User avatar
shoogen
Veteran
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: Review criteria

Post by shoogen »

But this code looks seriously flawed. In python you can't define new binary operators. Bitwise xor would be "^" whereas logical xor is a complicated as it is in c "bool(x) != bool (y)" or "(not x) != (not y)"
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Review criteria

Post by jriegel »

True, but this kind of bugs one have to fix in the SCL generator. The whole python code export is highly experimental. If it becomes important we have to team up with SCL to get it to better quality.

So far we use in Import still the OCAF importer, but for the long run I hope we can get ride of that special code portion of OCC....

Long story short - just ignore it ;)
Stop whining - start coding!
User avatar
shoogen
Veteran
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: Review criteria

Post by shoogen »

3. Files need to have proper licenses. The author information in the source code should match the authors of the git commits. (exceptions should be explained by the contributor)
4. Python modules should compile their resources at compile time (like Draft and Arch)
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Review criteria

Post by yorik »

shoogen wrote:4. Python modules should compile their resources at compile time (like Draft and Arch)
I think the only missing ones now are sanguinariojoe's ship and plot. There is the spreadsheet module too, but it seems that the C++ version is coming now...
Post Reply