summaryrefslogtreecommitdiff
path: root/format.py
diff options
context:
space:
mode:
authorDragorn421 <Dragorn421@users.noreply.github.com>2023-07-28 01:48:42 +0200
committerGitHub <noreply@github.com>2023-07-27 19:48:42 -0400
commit5fa018106bde15d414047a38ddac162323739419 (patch)
treeba01b82ae2df7c5faebcb9c3e7d47d267b77ccb3 /format.py
parent232fdb75d88854d41d6cf0a132e0dd16b69b0f9f (diff)
Prefer clang-format-14 (#1517)
* Change preferred clang version to 14 (for formatting) * Add `--show-paths` arg to format.py for printing paths to clang-* binaries used * Run formatter (clang-format-14) * run formatter
Diffstat (limited to 'format.py')
-rwxr-xr-xformat.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/format.py b/format.py
index 826a70783..51b7b6ac7 100755
--- a/format.py
+++ b/format.py
@@ -14,8 +14,8 @@ from typing import List
# clang-format, clang-tidy and clang-apply-replacements default version
-# Version 11 is used when available for more consistency between contributors
-CLANG_VER = 11
+# This specific version is used when available, for more consistency between contributors
+CLANG_VER = 14
# Clang-Format options (see .clang-format for rules applied)
FORMAT_OPTS = "-i -style=file"
@@ -144,6 +144,12 @@ def format_files(src_files: List[str], extra_files: List[str], nb_jobs: int):
def main():
parser = argparse.ArgumentParser(description="Format files in the codebase to enforce most style rules")
+ parser.add_argument(
+ "--show-paths",
+ dest="show_paths",
+ action="store_true",
+ help="Print the paths to the clang-* binaries used",
+ )
parser.add_argument("files", metavar="file", nargs="*")
parser.add_argument(
"-j",
@@ -155,6 +161,13 @@ def main():
)
args = parser.parse_args()
+ if args.show_paths:
+ import shutil
+
+ print("CLANG_FORMAT ->", shutil.which(CLANG_FORMAT))
+ print("CLANG_TIDY ->", shutil.which(CLANG_TIDY))
+ print("CLANG_APPLY_REPLACEMENTS ->", shutil.which(CLANG_APPLY_REPLACEMENTS))
+
nb_jobs = args.jobs or multiprocessing.cpu_count()
if nb_jobs > 1:
if CLANG_APPLY_REPLACEMENTS is None: