Fix Version/s: None
Team:Data Release Production
RFC-261. Update DM C++ Style Guide (primarily section 6) to enable automatic code layout with clang-format.
This involves adding a version controlled LSST clang-format style that is as much as possible compliant with the current layout rules. And subsequently removing or modifying the existing layout rules to be compliant with the output created by clang-format using this style.
The intended end result is that users can simply run clang-format (with the LSST provided style) to automatically fix all C++ code layout issues.
Users are still free to not use clang-format as long as the output looks the same.
- is triggered by
RFC-261 Automate C++ code layout with clang-format
Two minor notes. Pim Schellart [X] has already said this, but I hope we are willing to allow spaces around * and / because I think clang-format will insist on it. Also, clang-format in google style does unpredictable things with &, e.g. it sometimes adds a space afterwards and sometimes does not, and it may break a line between the & and the next item (I noticed this often when formatting pybind11 wrappers). I am not complaining or saying we should change anything, I am just hoping our standards will be loose enough to tolerate these issues. I am very much in favor of automatic formatting!
We will have to allow spaces, otherwise we cannot use clang-format, but the question is do we make them optional or mandatory?
As for the `&`, clang-format follows the Google rules, which allows it to be attached either to the type or the variable. I don't think we have any rule that conflicts with this behaviour.
Relatively minor suggestions on the PR. I'm sorry this has taken a long time, but I hope people are reasonably pleased with the result.
Merged after changes.
Thanks! I'm very happy that I can now use clang-format!
Kian-Tat Lim Ok, I think it is ready.