summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2023-03-14 11:01:04 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-03-16 01:01:11 +0000
commit6aaca42c18798471313f2e5d9c2c9327fba6133b (patch)
tree033ae60f162d4b71ab2706462dbffd4ddf0fcc58
parent7a9f47487c41d15b3f8aeb4372afc36fc0dfceae (diff)
downloadchrome-ec-factory-skyrim-15384.B-main.tar.gz
util/check_clang_format: Format C++ filesfactory-skyrim-15384.B-main
BRANCH=none BUG=none TEST=./util/check_clang_format.py Change-Id: Ie270a1683ff62b7cb7d95e972b2fe51119be9885 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4338477 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
-rwxr-xr-xutil/check_clang_format.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/util/check_clang_format.py b/util/check_clang_format.py
index 5862c02a3d..529a37302d 100755
--- a/util/check_clang_format.py
+++ b/util/check_clang_format.py
@@ -3,7 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Validate all C source is formatted with clang-format.
+"""Validate all C/C++ source is formatted with clang-format.
This isn't very useful to users to call directly, but it is run it the
CQ. Most users will likely find out they forgot to clang-format by
@@ -21,7 +21,7 @@ from chromite.lib import commandline
def main(argv=None):
- """Find all C files and runs clang-format on them."""
+ """Find all C/C++ files and runs clang-format on them."""
parser = commandline.ArgumentParser()
parser.add_argument(
"--fix",
@@ -59,7 +59,11 @@ def main(argv=None):
continue
if "third_party" in path.parts:
continue
- if path.name.endswith(".c") or path.name.endswith(".h"):
+ if (
+ path.name.endswith(".c")
+ or path.name.endswith(".cc")
+ or path.name.endswith(".h")
+ ):
cmd.append(path)
logging.debug("Running %s", " ".join(shlex.quote(str(x)) for x in cmd))
@@ -72,7 +76,7 @@ def main(argv=None):
stdin=subprocess.DEVNULL,
)
if result.stderr:
- logging.error("All C source must be formatted with clang-format!")
+ logging.error("All C/C++ source must be formatted with clang-format!")
for line in result.stderr.splitlines():
logging.error("%s", line)
return 1