I'll post my comments here (I'm waiting for a new hardware to setup the code review system for FreeCAD):
Local compiling & automated tests: PASS
Travis CI:
https://travis-ci.org/PrzemoF/FreeCAD/builds/82436449
1. That deserves a separate commit - it's not a comment, it's a change of way we filter inp files:
Code: Select all
diff --git a/src/Mod/Fem/TestFem.py b/src/Mod/Fem/TestFem.py
index ed822c0..7589ec5 100644
--- a/src/Mod/Fem/TestFem.py
+++ b/src/Mod/Fem/TestFem.py
@@ -119,8 +119,8 @@ class FemTest(unittest.TestCase):
file2 = open(file_name2, 'r')
f1 = file1.readlines()
f2 = file2.readlines()
- lf1 = [l for l in f1 if not l.startswith('**')]
- lf2 = [l for l in f2 if not l.startswith('**')]
+ lf1 = [l for l in f1 if not l.startswith('** written ')]
+ lf2 = [l for l in f2 if not l.startswith('** written ')]
import difflib
diff = difflib.unified_diff(lf1, lf2, n=0)
result = ''
2. I don't thinks it's right to use:
in src/Mod/Fem/ccxInpWriter.py
3. All prints should use brackets to be future proof (python3 porting):
Code: Select all
$ python3
Python 3.4.2 (default, Jul 9 2015, 17:24:30)
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print 'test'
File "<stdin>", line 1
print 'test'
^
SyntaxError: Missing parentheses in call to 'print'
>>> print ('test')
test
Below are just mine opinions - please ignore if you don't like them!
:
1. I try to use short variable names like f, mo, el, r only when they are used very close to the definition or when it's very obvious what's behind (like our f variable for file in the inp writer that is everywhere).
2. Names like has_remaining_femelements_shellthickness or write_ccx_elsets_definitions_material_and_femelementtype( are probably a bit too long for non German speakers
. I don't completely understand the code, so I'm not sure what name would be better (shorter, but still giving a clear message). Again, it's a matter of preference.
3. There is a saying (C language) that if you have more than 3 indentation levels you need to fix you program. I know that python is a bit different, but reading deeply nested if/for is hard. in generate_ccx_elsets there is if/for/for/if/for/if - could you use some helper functions? I tried to analysy the code, but my brain is boiling with that kind of nesting
4. I'm guilty of using that kind of naming as well, but check_femelements_count doesn't tell if True of False is the expected, no error retult. What about name fem_elements_count_ok?
5.
Code: Select all
__author__ = "Przemo Firszt", "Bernd Hahnebach"
should probably be
Code: Select all
__author__ = "Bernd Hahnebach, Przemo Firszt"
I think a single string is expected.