precommit: Get fortitude auto-fixing to work

This commit is contained in:
Ole Schütt 2025-11-06 10:32:17 +01:00 committed by Ole Schütt
parent bfa23ca8e4
commit 6bdde325c8
2 changed files with 15 additions and 4 deletions

View file

@ -234,10 +234,14 @@ def process_file(fn: str, allow_modifications: bool) -> None:
run_format_fortran(fn)
if re.match(r".*\.F$", fn) and basename not in FORTITUDE_EXCLUDE:
fypped_fn = SCRATCH_DIR / basename
run_local_tool("./tools/build_utils/fypp", fn, str(fypped_fn))
run_remote_tool("fortitude", str(fypped_fn))
fypped_fn.unlink()
try:
# First try without fypp as this allows for auto-fixing.
run_remote_tool("fortitude", fn)
except Exception as err:
fypped_fn = SCRATCH_DIR / basename
run_local_tool("./tools/build_utils/fypp", fn, str(fypped_fn))
run_remote_tool("fortitude_nofix", str(fypped_fn))
fypped_fn.unlink()
if re.match(r".*\.(c|cu|cl|h)$", fn):
run_remote_tool("clangformat", fn)