personalrobotics / chimera

:snake: A CLI tool for generating Boost.Python/pybind11 bindings from C/C++
BSD 3-Clause "New" or "Revised" License
13 stars 1 forks source link

Format generated bindings using ClangFormat if available #302

Open jslee02 opened 4 years ago

jslee02 commented 4 years ago

Generated bindings are generally not well-formatted. We could format the code using ClangFormat if detected.

psigen commented 4 years ago

We should not have to do this if we can simply appropriately adjust the templates. We can run clang format and use that to adjust the templates until it matches.

jslee02 commented 4 years ago

There could be some limitations on that approach such as the column limit.

I understand that code formatting can be done on the user side, and it's one of the motivations of #304 to get the list of generated files for formatting.

jslee02 commented 4 years ago

This feature would be very useful for the case that chimera is not currently not able to generate for the entire C++ codebase for some reason but still used to generate partial bindings. In this case, the user might need to modify the generated bindings manually. It would be less convenient to manage unformatted code (imagine chimera generates very long length of method binding with long mangled names, options, etc).