Hi all, clang-format seems like a great tool to reformat our whole codebase once and for all, and keep it that way. I've added a configuration file "_clang-format" to trunk, hoping that others can have a look at it too and tweak the settings for our project. Can you have a look at this Krzysztof?
(my bigger ambition is to run clang-format on the whole codebase after we branch-off the next release)
Thanks, Johan
On 31-Oct-2013 15:44, Johan Engelen wrote:
(my bigger ambition is to run clang-format on the whole codebase after we branch-off the next release)
The "whole" codebase - depends on what that includes. Libraries included from elsewhere may not have the same format as the Inkscape specific code.
Regards,
David Mathog mathog@...1176... Manager, Sequence Analysis Facility, Biology Division, Caltech
On 1-11-2013 0:15, mathog wrote:
On 31-Oct-2013 15:44, Johan Engelen wrote:
(my bigger ambition is to run clang-format on the whole codebase after we branch-off the next release)
The "whole" codebase - depends on what that includes. Libraries included from elsewhere may not have the same format as the Inkscape specific code.
Thank you for pointing this out. Indeed, we should skip the 2geom and the lib* folders.
regards, Johan
AlwaysBreakTemplateDeclarations: false
I think this should be true (e.g. the template parameters should always be on their own line)
BreakConstructorInitializersBeforeComma: false
This should also be true - if I get it right, setting this to true will give us a Boost-like initializer list (as seen in 2Geom), which is easier to maintain.
ConstructorInitializerAllOnOneLineOrOnePerLine: false
This also sounds like it should be true.
MaxEmptyLinesToKeep: 1
I would set this to 2 or even 3.
Otherwise the file looks OK. I would rename it to "clangformatrc", in parallel to the astylerc we already have.
Regards, Krzysztof
On 1-11-2013 15:40, Krzysztof Kosiński wrote:
AlwaysBreakTemplateDeclarations: false
I think this should be true (e.g. the template parameters should always be on their own line)
BreakConstructorInitializersBeforeComma: false
This should also be true - if I get it right, setting this to true will give us a Boost-like initializer list (as seen in 2Geom), which is easier to maintain.
ConstructorInitializerAllOnOneLineOrOnePerLine: false
This also sounds like it should be true.
MaxEmptyLinesToKeep: 1
I would set this to 2 or even 3.
Thanks, I'll try the changes.
Otherwise the file looks OK. I would rename it to "clangformatrc", in parallel to the astylerc we already have.
The file has to be named .clang-format or _clang-format, the filename is hardcoded (clang-format automatically searches parent folders of the src file).
Once we get this pretty-printing correct, we no longer need a page on code layouting, as we can simply point to the program to use to pretty-print new code. I hope this keeps our code clean and prevents confusions/discussions.
regards, Johan
2013/11/1 Johan Engelen <jbc.engelen@...2592...>:
The file has to be named .clang-format or _clang-format, the filename is hardcoded (clang-format automatically searches parent folders of the src file).
OK, I didn't know about this.
Once we get this pretty-printing correct, we no longer need a page on code layouting, as we can simply point to the program to use to pretty-print new code. I hope this keeps our code clean and prevents confusions/discussions.
I think the existing documentation of the coding style should be left in place, because not everyone has clang-format available.
Regards, Krzysztof
participants (3)
-
Johan Engelen
-
Krzysztof Kosiński
-
mathog