From 3b7f58fb9f218a82e5cea2d5d7a524dcc1b25f5d Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Tue, 16 Apr 2019 15:14:25 +0200 Subject: [PATCH] clang_format_paths: expand tabs for cmake too --- utils/clang_format_paths.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/utils/clang_format_paths.py b/utils/clang_format_paths.py index 06e813f..4f94f71 100755 --- a/utils/clang_format_paths.py +++ b/utils/clang_format_paths.py @@ -16,6 +16,11 @@ extensions = ( ".osl", ".glsl", ) +extensions_cmake = ( + ".cmake", + "CMakeLists.txt", +) + ignore_files = { "intern/cycles/render/sobol.cpp", # Too heavy for clang-format } @@ -152,6 +157,8 @@ def main(): args = argparse_create().parse_args() + use_default_paths = bool(args.paths) + paths = compute_paths(args.paths) print("Operating on:") for p in paths: @@ -163,8 +170,15 @@ def main(): if f not in ignore_files ] + # Always operate on all cmake files (when expanding tabs and no paths given). + files_cmake = [ + f for f in source_files_from_git("." if use_default_paths else paths) + if f.endswith(extensions_cmake) + if f not in ignore_files + ] + if args.expand_tabs: - convert_tabs_to_spaces(files) + convert_tabs_to_spaces(files + files_cmake) clang_format(files) -- GitLab