mirror of
https://github.com/Mbed-TLS/mbedtls-framework.git
synced 2026-06-05 21:15:09 +00:00
Also apply --uncrustify to --fix mode
Before this commit, verify mode still hard-coded "uncrustify" as the command name. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@@ -15,7 +15,6 @@ from mbedtls_framework import build_tree
|
||||
|
||||
UNCRUSTIFY_SUPPORTED_VERSION = "0.75.1"
|
||||
CONFIG_FILE = ".uncrustify.cfg"
|
||||
UNCRUSTIFY_EXE = "uncrustify"
|
||||
UNCRUSTIFY_ARGS = ["-c", CONFIG_FILE]
|
||||
CHECK_GENERATED_FILES = "tests/scripts/check-generated-files.sh"
|
||||
|
||||
@@ -213,13 +212,14 @@ def check_style_is_correct(uncrustify_exe: str,
|
||||
|
||||
return style_correct
|
||||
|
||||
def fix_style_single_pass(src_file_list: List[str]) -> bool:
|
||||
def fix_style_single_pass(uncrustify_exe: str,
|
||||
src_file_list: List[str]) -> bool:
|
||||
"""
|
||||
Run Uncrustify once over the source files.
|
||||
"""
|
||||
code_change_args = UNCRUSTIFY_ARGS + ["--no-backup"]
|
||||
for src_file in src_file_list:
|
||||
uncrustify_cmd = [UNCRUSTIFY_EXE] + code_change_args + [src_file]
|
||||
uncrustify_cmd = [uncrustify_exe] + code_change_args + [src_file]
|
||||
result = subprocess.run(uncrustify_cmd, check=False)
|
||||
if result.returncode != 0:
|
||||
print_err("Uncrustify with file returned: " +
|
||||
@@ -232,9 +232,9 @@ def fix_style(uncrustify_exe: str, src_file_list: List[str]) -> int:
|
||||
"""
|
||||
Fix the code style. This takes 2 passes of Uncrustify.
|
||||
"""
|
||||
if not fix_style_single_pass(src_file_list):
|
||||
if not fix_style_single_pass(uncrustify_exe, src_file_list):
|
||||
return 1
|
||||
if not fix_style_single_pass(src_file_list):
|
||||
if not fix_style_single_pass(uncrustify_exe, src_file_list):
|
||||
return 1
|
||||
|
||||
# Guard against future changes that cause the codebase to require
|
||||
|
||||
Reference in New Issue
Block a user