ament / ament_lint

Apache License 2.0
38 stars 107 forks source link

[ament_clang_format] Support pointing to config file rather than YAML load/dump for clang-format>=14.0.0 #383

Open aprotyas opened 2 years ago

aprotyas commented 2 years ago

What?

From the clang-format v14.0.0 changelog:

The command line argument -style=<string> has been extended so that a specific format file at location <format_file_path> can be selected. This is supported via the syntax: -style=file:<format_file_path>.

Given that the default clang-format version in Ubuntu 22.04 is >=14~, it's reasonable to expect that the configuration file argument will just be passed as a file path to the invoked clang-format binary (for appropriate versions) rather than as a dumped YAML stream.

Why?

The main use-case for this feature request is to handle cases like #364, where multiple configurations for different languages mean that there are multiple YAML documents in the same file. The YAML load API does not like this, even though this is a perfectly fine use of the clang-format configuration.