FreeCAD
FreeCAD copied to clipboard
[Problem] Whitespace/Indentation uniformity issues in `src/Mod/Part/App/Geom2d` XML (API) files
Is there an existing issue for this?
- [X] I have searched the existing issues
Problem description
The XML files in https://github.com/FreeCAD/FreeCAD/tree/master/src/Mod/Part/App/Geom2d have non-uniform whitespace.
4 spaced indentation
https://github.com/FreeCAD/FreeCAD/blob/4293c4a65b0e69975dcdbbf68c80d8019a4f850d/src/Mod/Part/App/Geom2d/ArcOfCircle2dPy.xml#L1-L31
- https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/Geom2d/ArcOfConic2dPy.xml
- https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/Geom2d/ArcOfEllipse2dPy.xml
- https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/Geom2d/ArcOfHyperbola2dPy.xml
- https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/Geom2d/ArcOfParabola2dPy.xml
- https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/Geom2d/Circle2dPy.xml
- https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/Geom2d/Conic2dPy.xml
- https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/Geom2d/Geometry2dPy.xml
- https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/Geom2d/Line2dPy.xml
- https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/Geom2d/Line2dSegmentPy.xml
Tabbed space (or 8 spaced) indentation example
https://github.com/FreeCAD/FreeCAD/blob/4293c4a65b0e69975dcdbbf68c80d8019a4f850d/src/Mod/Part/App/Geom2d/Parabola2dPy.xml#L1-L42
- https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/Geom2d/BSplineCurve2dPy.xml
- https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/Geom2d/BezierCurve2dPy.xml
- https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/Geom2d/Curve2dPy.xml
- https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/Geom2d/Ellipse2dPy.xml
- https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/Geom2d/Hyperbola2dPy.xml
- https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/Geom2d/OffsetCurve2dPy.xml
Full version info
Current v0.22 master
Subproject(s) affected?
Part
Anything else?
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
What is the official linting style of the FreeCAD API documentation ?
@chennes is this something mentioned in the Developer handbook ?
Hey @luzpaz are you currently working on this issue?
@johnmichaeldnichols nope :smile:
Feel free to jump in!
Currently, waiting on guidelines for what indentation is preferred.
CC @chennes
@wwmayer what is the agreed upon indentation format for the .xml documentation ?
I don't know if this is officially documented but I vote to apply the same indentation rules as for our C++ or Python code: 4 spaces, no tabs
@chennes @yorikvanhavre please weigh-in
Agreed, 4 spaces, no tabs. Note that I think XML auto formatters are likely to give us headaches in the *Py.xml files, where we have many docstrings that won't use the expected indentation. So it's an area we will want to take care with if we decide to go with the automatic formatters.
How to proceed here ?
@luzpaz how to approach here ? Could you help.
I haven't found a utility to do the XML formatting as we want it. There is xmllint but it uses only two spaces. So, I have written our own utility: https://github.com/FreeCAD/FreeCAD/pull/11219
@wwmayer sorry to ping but in that case how does it affect this ticket ?
The utility will replace all tabs with spaces and uses 4 spaces for the indentations. So, exactly this what the ticket is about.
@wwmayer yea, that's what I figured. Thanks for the clarification. Any idea when the utility will be run on the codebase ?
Is the plan to run the utility before 1.0 release ?
Yes, we can do that.
I was looking for an easy project and saw this one, and saw that it was still undone, so I did it. I only checked the *.xml files in the named directory, and only repaired the ones with problems. So if wwmayer wants to run his XML Repair Tool on all XML files everywhere, he can still do that, otherwise he is now freed up for more important work. PR to follow soon. Thanks.