From e9baec63d993dce1d3145174235e289015acc0d0 Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Mon, 17 Mar 2025 12:42:20 -0400 Subject: [PATCH] ci(utils/fileHeaders): added one time run script to generate file headers --- utils/fileHeaders/run_format_headers.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 utils/fileHeaders/run_format_headers.py diff --git a/utils/fileHeaders/run_format_headers.py b/utils/fileHeaders/run_format_headers.py new file mode 100755 index 0000000..b4100f2 --- /dev/null +++ b/utils/fileHeaders/run_format_headers.py @@ -0,0 +1,17 @@ +import pathlib +import os +import subprocess + +def run_format_headers(): + root = "../../src" + script = "../../commit-config/hooks/formatHeader.py" + + validExtensions = [".c", ".h", ".cpp", ".hpp", ".py", ".f", ".f90"] + + for path in pathlib.Path(root).rglob("*"): + if path.is_file() and path.suffix in validExtensions: + print(f"Adding header to: {path}") + subprocess.run(["python", script, str(path)], stdout=subprocess.PIPE) + +if __name__ == "__main__": + run_format_headers() \ No newline at end of file