Update .clang-format
There are currently no pipelines.
To run a merge request pipeline, the jobs in the CI/CD configuration file must be configured to run in merge request pipelines and you must have sufficient permissions in the source project.
Consistent code formatting is important! clang-format is the best tool for automatic C++ formatting. We already have a .clang-format
configuration file at the root of the project. But it was copy-pasted from ITK and is poorly suited to current OTB code. I think our .clang-format
configuration should be such that it produces the minimum diff to current source files and still looks good and familiar to new developers. In this MR I do two things:
.clang-format
. The most significant changes are:BreakBeforeBraces: Allman
ColumnLimit: 160
I like Allman style because it's close to the current GNU/Whitesmiths style used in ITK, but is more self-consistent (all brace pairs follow the same indentation logic) and I believe it is much more familiar with new developers and other C++ projects (I have never seen GNU style elsewhere than OTB or ITK...). The 160 column limit seems like a good compromise after a few trial and errors on the whole code base.
The other elements should be trivial (but feel free to bikeshed of course!).
M Examples/Registration/ImageRegistration1.cxx
M Modules/Applications/AppEdge/app/otbEdgeExtraction.cxx
M Modules/Core/ImageBase/include/otbVectorImage.hxx
If you don't have clang-format installed, you can use this to see if you agree with the proposed configuration.
That's up for debate but personally I would not. I would run it on new files and some files where the indentation is very wrong (otbEdgeExtraction.cxx is one example). We can do it gradually.
The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.
Check before merging:
To run a merge request pipeline, the jobs in the CI/CD configuration file must be configured to run in merge request pipelines and you must have sufficient permissions in the source project.