From 2cf779ceff908b1e7bb54cb609f5e7d35e48d33e Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Thu, 8 Dec 2022 14:44:36 +0000 Subject: [PATCH] Use constant for supported Uncrustify version Define and report the supported Uncrustify version (and remove extra newlines from version output). Signed-off-by: David Horstmann --- scripts/code_style.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/code_style.py b/scripts/code_style.py index be333f093f..4aa9a40a0f 100755 --- a/scripts/code_style.py +++ b/scripts/code_style.py @@ -22,6 +22,7 @@ import subprocess import sys from typing import List +UNCRUSTIFY_SUPPORTED_VERSION = "0.75.1" CONFIG_FILE = "codestyle.cfg" UNCRUSTIFY_EXE = "uncrustify" UNCRUSTIFY_ARGS = ["-c", CONFIG_FILE] @@ -125,10 +126,11 @@ def main() -> int: """ Main with command line arguments. """ - uncrustify_version = get_uncrustify_version() - if "0.75.1" not in uncrustify_version: + uncrustify_version = get_uncrustify_version().strip() + if UNCRUSTIFY_SUPPORTED_VERSION not in uncrustify_version: print("Warning: Using unsupported Uncrustify version '" \ - + uncrustify_version + "'", file=STDOUT_UTF8) + + uncrustify_version + "' (Note: The only supported version" \ + "is " + UNCRUSTIFY_SUPPORTED_VERSION + ")", file=STDOUT_UTF8) src_files = get_src_files()