3
0
mirror of https://github.com/CrazyRedMachine/popnhax.git synced 2024-12-18 07:55:52 +01:00
popnhax/clang-format.py
CrazyRedMachine 698e9c5476 Omnimix v2
2023-02-10 20:33:37 +01:00

31 lines
1.2 KiB
Python

import os
import subprocess
ignore_folders = [".git", "build", "dist", "minhook"]
cpp_extensions = (".cpp", ".cxx", ".c++", ".h++", ".hpp", ".hxx")
for root, dirs, files in os.walk(".", topdown=True):
dirs[:] = [d for d in dirs if d not in ignore_folders]
for filename in files:
if filename.endswith(cpp_extensions):
print(filename)
subprocess.check_call(["clang-format", "-i", "-style=file", root + "/" + filename])
# print(" ".join(["clang-tidy", root + "/" + filename, "--", "-I."]))
subprocess.check_call(["./clang-tidy.sh", root + "/" + filename, "c++11"])
print()
cpp_extensions = (".cc", ".cp", ".c", ".i", ".ii", ".h")
for root, dirs, files in os.walk(".", topdown=True):
dirs[:] = [d for d in dirs if d not in ignore_folders]
for filename in files:
if filename.endswith(cpp_extensions):
print(filename)
subprocess.check_call(["clang-format", "-i", "-style=file", root + "/" + filename])
# print(" ".join(["clang-tidy", root + "/" + filename, "--", "-I."]))
subprocess.check_call(["./clang-tidy.sh", root + "/" + filename, "c11"])
print()