tools/format-cpp: enforce clang-format 13
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 27 Jan 2022 16:00:30 +0000 (11:00 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 28 Jan 2022 16:22:26 +0000 (11:22 -0500)
commit9021ae77076ea1805eb09d0d93f8d1a4081b633c
tree9a629b1d0063463ba332498dfc80da90d4652e33
parentff7ea753d4069f125953d690df066c5b8c83e4c2
tools/format-cpp: enforce clang-format 13

This patch updates `tools/format-cpp` so that if the `FORMATTER`
environment variable is not empty, the script tries to format with
`$FORMATTER`; otherwise, it tries `clang-format-13 -i` or, if not
available, `clang-format -i`.

In all cases, the script checks the major version of the selected
formatter with `--version`, failing before formatting if it's not 13.

Using exactly clang-format 13 is important for formatting consistency
across developers and CI systems because it's possible that a future
version of clang-format, given the same configuration file, formats
files dissimilarly.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ic81d8d09c35657b602de044f6123e8b11fc37c44
Reviewed-on: https://review.lttng.org/c/babeltrace/+/7151
tools/format-cpp
This page took 0.023695 seconds and 4 git commands to generate.