<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 21 Mar 2022 at 10:01, Nicklas Larsson via grass-dev <<a href="mailto:grass-dev@lists.osgeo.org">grass-dev@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">...There were attempts to do this [2, 3], but numerous problem arose...which are based on GNU Indent [4]. These problem are probably originate in the comparatively limited functionality and lack of active development on GNU Indent.<br></blockquote><div><br></div><div></div><div>Additionally, the C++ support in GNU Indent is limited:</div><div><br></div><div>While an attempt was made to get indent working for C++, it will not do a good job on any C++ source except the very simplest. <br></div><div></div><div><a href="https://www.gnu.org/software/indent/manual/indent/Bugs.html">https://www.gnu.org/software/indent/manual/indent/Bugs.html</a><br></div><div><br></div><div>I think the note in the docs was there even before C++11.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I have created a `.clang-format` file with the settings as close as possible to the ones in `grass_indent.sh` (somewhat outdated described in [7]).<br></blockquote><div><br></div><div>I don't think the style is set in stone. This is perhaps for a next phase, but unless a strong standard emerges for C/C++, we may consider switching to something which is close to Black given our mixed code base. Function signatures and calls would be the big change there. However, the closing parenthesis on a separate line typical to Black is available only in the upcoming ClangFormat 14.</div><div><br></div><div>On the other hand, yielding to some 3rd party standard seems like a good idea especially for all the C++ syntax.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Now the question is first of all: is using ClangFormat something the GRASS dev community (you) would want or could live with for this project?<br></blockquote><div><br></div><div>+1. Being tool-independent is not possible here and ClangFormat seems to do the job.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
And if so, what version of ClangFormat should then be the starting point (what do you have reasonably easy available for your dev platform)? The present settings in the PR are derived from ClangFormat 13, but could possibly be back ported if really needed.<br></blockquote><div><br></div><div>You can run a specific version locally using Docker thanks to a related GitHub Action:<br></div><div><br></div><div><a href="https://github.com/DoozyX/clang-format-lint-action#run-locally">https://github.com/DoozyX/clang-format-lint-action#run-locally</a></div><div> </div><div>Harder to integrate in your editor, but at least something. (Yes, your favorite editor may already have support for ClangFormat.)<br></div><br></div></div>