precommit: Add cmake-format

This commit is contained in:
Ole Schütt 2021-11-29 18:50:59 +01:00 committed by Ole Schütt
parent 101ec7dbd9
commit 3120b66bfc
3 changed files with 12 additions and 0 deletions

View file

@ -201,6 +201,9 @@ def process_file(fn, allow_modifications):
if re.match(r".*\.md$", fn):
run_remote_tool("markdownlint", fn)
if re.match(r"(.*/CMakeLists.txt)|(.*\.cmake)$", fn):
run_remote_tool("cmakeformat", fn)
if re.match(r"./data/.*POTENTIALS?$", fn):
check_data_files()

View file

@ -52,6 +52,12 @@ def clangformat():
return run_tool(["clang-format", "--style=llvm", "-i"])
# ======================================================================================
@app.route("/cmakeformat", methods=["POST"])
def cmakeformat():
return run_tool(["cmake-format", "-i"])
# ======================================================================================
def run_tool(cmd, timeout=30):
assert len(request.files) == 1

View file

@ -2,6 +2,8 @@ appdirs==1.4.4
attrs==20.1.0
black==19.10b0
click==7.1.2
cmake-format==0.6.13
cmakelang==0.6.13
Flask==1.1.2
gunicorn==20.0.4
itsdangerous==1.1.0
@ -9,6 +11,7 @@ Jinja2==2.11.3
MarkupSafe==1.1.1
pathspec==0.8.0
regex==2020.7.14
six==1.16.0
toml==0.10.1
typed-ast==1.4.1
Werkzeug==1.0.1