FEM: code formating

Merged, abandoned or rejected pull requests are moved here to clear the main Pull Requests forum.
User avatar
bernd
Posts: 8489
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

FEM: code formating

Postby bernd » Sat Apr 23, 2016 8:51 pm

Hi Werner,

we had a small conversation in this regard already. The problem is all FEM python code uses UNIX line endings. Most FEM C++ uses windows line endings or unix line endings. There are even C++ files which have both windows and unix line endings. GIT has some smart tools to get around this but most Developer of FEM do not know how to use them. We end up talking again and again about line endings in commits. Since we switched for all python code in FEM to unix line endings we got rid of the line endings problem for them. I gave it a try for the C++ code files too, quite a lot. Find the appropriate commit attached as well as removing all trailing white spaces and tabs at line start.

cheers bernd

branch:
https://github.com/berndhahnebach/FreeC ... eformating

FEM unit test:
passed

travis:
does not pass but this is not due FEM.

git request-pull sfmaster/master https://github.com/berndhahnebach/FreeCAD_bhb femcodeformating
The following changes since commit b08a75bfb2583baf710c3ae95c7b8227bbdc8daf:

Attempt to fix gcc build (2016-04-21 22:34:20 +0300)

are available in the git repository at:

https://github.com/berndhahnebach/FreeCAD_bhb femcodeformating

for you to fetch changes up to 60316b88022304e828c73a39bc2addff10763cd4:

FEM: replace tabs at line start by spaces (2016-04-23 13:54:52 +0200)

----------------------------------------------------------------
Bernd Hahnebach (3):
FEM: convert all windows code files to unix line ending
FEM: remove trailing whitespaces
FEM: replace tabs at line start by spaces

src/Mod/Fem/App/AppFem.cpp | 296 +++---
src/Mod/Fem/App/AppFemPy.cpp | 486 +++++-----
src/Mod/Fem/App/CMakeLists.txt | 26 +-
src/Mod/Fem/App/FemAnalysis.cpp | 2 +-
src/Mod/Fem/App/FemAnalysis.h | 2 +-
src/Mod/Fem/App/FemConstraint.h | 162 ++--
src/Mod/Fem/App/FemConstraintBearing.cpp | 234 ++---
src/Mod/Fem/App/FemConstraintBearing.h | 142 +--
src/Mod/Fem/App/FemConstraintDisplacement.cpp | 34 +-
src/Mod/Fem/App/FemConstraintDisplacement.h | 14 +-
src/Mod/Fem/App/FemConstraintFixed.cpp | 172 ++--
src/Mod/Fem/App/FemConstraintFixed.h | 126 +--
src/Mod/Fem/App/FemConstraintForce.cpp | 218 ++---
src/Mod/Fem/App/FemConstraintForce.h | 138 +--
src/Mod/Fem/App/FemConstraintGear.cpp | 172 ++--
src/Mod/Fem/App/FemConstraintGear.h | 140 +--
src/Mod/Fem/App/FemConstraintPulley.cpp | 196 ++--
src/Mod/Fem/App/FemConstraintPulley.h | 146 +--
src/Mod/Fem/App/FemMesh.cpp | 2828 ++++++++++++++++++++++++++---------------------------
src/Mod/Fem/App/FemMesh.h | 326 +++----
src/Mod/Fem/App/FemMeshObject.cpp | 144 +--
src/Mod/Fem/App/FemMeshObject.h | 132 +--
src/Mod/Fem/App/FemMeshProperty.cpp | 314 +++---
src/Mod/Fem/App/FemMeshProperty.h | 186 ++--
src/Mod/Fem/App/FemMeshPy.xml | 484 +++++-----
src/Mod/Fem/App/FemMeshPyImp.cpp | 1924 ++++++++++++++++++------------------
src/Mod/Fem/App/FemMeshShapeObject.cpp | 22 +-
src/Mod/Fem/App/FemResultObject.cpp | 2 +-
src/Mod/Fem/App/FemSetElementsObject.cpp | 2 +-
src/Mod/Fem/App/FemSetFacesObject.cpp | 2 +-
src/Mod/Fem/App/FemSetGeometryObject.cpp | 2 +-
src/Mod/Fem/App/FemSetNodesObject.cpp | 2 +-
src/Mod/Fem/App/FemSetObject.cpp | 2 +-
src/Mod/Fem/App/FemSolverObject.cpp | 2 +-
src/Mod/Fem/App/FemSolverObject.h | 2 +-
src/Mod/Fem/App/FemTools.h | 4 +-
src/Mod/Fem/App/HypothesisPy.h | 842 ++++++++--------
src/Mod/Fem/App/PreCompiled.cpp | 48 +-
src/Mod/Fem/App/PreCompiled.h | 142 +--
src/Mod/Fem/Gui/AppFemGuiPy.cpp | 312 +++---
src/Mod/Fem/Gui/CMakeLists.txt | 8 +-
src/Mod/Fem/Gui/Command.cpp | 1556 +++++++++++++++---------------
src/Mod/Fem/Gui/FemSelectionGate.h | 6 +-
src/Mod/Fem/Gui/PreCompiled.cpp | 48 +-
src/Mod/Fem/Gui/PreCompiled.h | 156 +--
src/Mod/Fem/Gui/Resources/Fem.qrc | 110 +--
src/Mod/Fem/Gui/Resources/UpdateResources.bat | 4 +-
src/Mod/Fem/Gui/TaskAnalysisInfo.cpp | 2 +-
src/Mod/Fem/Gui/TaskAnalysisInfo.h | 2 +-
src/Mod/Fem/Gui/TaskCreateNodeSet.cpp | 6 +-
src/Mod/Fem/Gui/TaskCreateNodeSet.h | 2 +-
src/Mod/Fem/Gui/TaskDlgAnalysis.cpp | 4 +-
src/Mod/Fem/Gui/TaskDlgAnalysis.h | 8 +-
src/Mod/Fem/Gui/TaskDlgCreateNodeSet.cpp | 4 +-
src/Mod/Fem/Gui/TaskDlgCreateNodeSet.h | 8 +-
src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.cpp | 2 +-
src/Mod/Fem/Gui/TaskDlgMeshShapeNetgen.h | 6 +-
src/Mod/Fem/Gui/TaskDriver.cpp | 2 +-
src/Mod/Fem/Gui/TaskDriver.h | 2 +-
src/Mod/Fem/Gui/TaskFemConstraint.cpp | 456 ++++-----
src/Mod/Fem/Gui/TaskFemConstraint.h | 216 ++---
src/Mod/Fem/Gui/TaskFemConstraintBearing.cpp | 716 +++++++-------
src/Mod/Fem/Gui/TaskFemConstraintBearing.h | 184 ++--
src/Mod/Fem/Gui/TaskFemConstraintDisplacement.h | 6 +-
src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp | 472 ++++-----
src/Mod/Fem/Gui/TaskFemConstraintFixed.h | 168 ++--
src/Mod/Fem/Gui/TaskFemConstraintForce.cpp | 806 ++++++++--------
src/Mod/Fem/Gui/TaskFemConstraintForce.h | 188 ++--
src/Mod/Fem/Gui/TaskFemConstraintGear.cpp | 632 ++++++------
src/Mod/Fem/Gui/TaskFemConstraintGear.h | 158 +--
src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp | 4 +-
src/Mod/Fem/Gui/TaskFemConstraintPulley.cpp | 442 ++++-----
src/Mod/Fem/Gui/TaskFemConstraintPulley.h | 148 +--
src/Mod/Fem/Gui/TaskObjectName.cpp | 2 +-
src/Mod/Fem/Gui/TaskObjectName.h | 4 +-
src/Mod/Fem/Gui/TaskTetParameter.h | 4 +-
src/Mod/Fem/Gui/ViewProviderAnalysis.cpp | 6 +-
src/Mod/Fem/Gui/ViewProviderFemConstraint.cpp | 992 +++++++++----------
src/Mod/Fem/Gui/ViewProviderFemConstraint.h | 246 ++---
src/Mod/Fem/Gui/ViewProviderFemConstraintBearing.cpp | 304 +++---
src/Mod/Fem/Gui/ViewProviderFemConstraintBearing.h | 100 +-
src/Mod/Fem/Gui/ViewProviderFemConstraintDisplacement.cpp | 178 ++--
src/Mod/Fem/Gui/ViewProviderFemConstraintFixed.cpp | 340 +++----
src/Mod/Fem/Gui/ViewProviderFemConstraintFixed.h | 100 +-
src/Mod/Fem/Gui/ViewProviderFemConstraintForce.cpp | 426 ++++----
src/Mod/Fem/Gui/ViewProviderFemConstraintForce.h | 108 +--
src/Mod/Fem/Gui/ViewProviderFemConstraintGear.cpp | 386 ++++----
src/Mod/Fem/Gui/ViewProviderFemConstraintGear.h | 100 +-
src/Mod/Fem/Gui/ViewProviderFemConstraintPressure.cpp | 4 +-
src/Mod/Fem/Gui/ViewProviderFemConstraintPulley.cpp | 454 ++++-----
src/Mod/Fem/Gui/ViewProviderFemConstraintPulley.h | 100 +-
src/Mod/Fem/Gui/ViewProviderFemMesh.cpp | 4932 ++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------
src/Mod/Fem/Gui/ViewProviderFemMesh.h | 298 +++---
src/Mod/Fem/Gui/ViewProviderFemMeshPy.xml | 122 +--
src/Mod/Fem/Gui/ViewProviderFemMeshPyImp.cpp | 6 +-
src/Mod/Fem/Gui/ViewProviderFemMeshShape.cpp | 2 +-
src/Mod/Fem/Gui/ViewProviderSolver.h | 6 +-
src/Mod/Fem/Gui/Workbench.cpp | 4 +-
src/Mod/Fem/Gui/Workbench.h | 100 +-
99 files changed, 13143 insertions(+), 13143 deletions(-)
User avatar
f3nix
Posts: 299
Joined: Sat May 30, 2015 11:58 am

Re: FEM: code formating

Postby f3nix » Sat Apr 23, 2016 9:29 pm

Hi bernd,
I have only read about it and don't know how to do it in practice. But shouldn't the changes be guarded with a specially crafted .gitattributes file so this problem won't happen again in the future?

Cheers,
Mateusz
wmayer
Site Admin
Posts: 15001
Joined: Thu Feb 19, 2009 10:32 am

Re: FEM: code formating

Postby wmayer » Sun Apr 24, 2016 12:53 pm

travis:
does not pass but this is not due FEM.
It reached the time limit.


Merged.
User avatar
bernd
Posts: 8489
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: FEM: code formating

Postby bernd » Tue Apr 26, 2016 11:41 am

f3nix wrote: ... shouldn't the changes be guarded with a specially crafted .gitattributes file so this problem won't happen again in the future? ...

I had a look at the .gitattributes. Makes sense to me if it is possible to define for files in src/Mod/Fem only. The problem is I'm not experienced in git either and there are so many different opinions in the regard of line endings over the internet.