This is the workaround script I am currently writing, and those who need it can give it a try. However, I would prefer if the engineers could fix this issue.
import os
import sys
if len(sys.argv) < 2:
print("you can input the folder path from commandLine")
folder_path = sys.argv[1]
if not os.path.isdir(folder_path):
print("Invalid path parameter")
folder_path = input("Please input the folder path: ")
if not os.path.exists(folder_path):
print("Folder path does not exist")
exit()
for root, dirs, files in os.walk(folder_path):
for file in files:
if file.endswith(".h"):
file_path = os.path.join(root, file)
with open(file_path, "r") as f:
lines = f.readlines()
modified_lines = []
i = 0
while i < len(lines):
if "module:" in lines[i] and lines[i].lstrip().startswith("module:"):
if i > 0 and lines[i - 1].strip():
modified_lines[-1] = modified_lines[-1].rstrip() + " " + lines[i].lstrip().replace(" module:", " ")
else:
modified_lines.append(lines[i])
else:
modified_lines.append(lines[i])
i += 1
with open(file_path, "w") as f:
f.writelines(modified_lines)
print("Finished")