From 5ee6bf45634706c063db0592589754f66cd5bb00 Mon Sep 17 00:00:00 2001 From: William Murphy Date: Mon, 24 Jul 2023 10:10:06 -0400 Subject: [PATCH] chore: in quality tests, only colorize quality output if in a tty (#1398) Permit piping "make validate" (from test/quality) to a file without filling it with control characters. Signed-off-by: Will Murphy --- test/quality/gate.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/quality/gate.py b/test/quality/gate.py index 3d615f98d16..b786831513f 100755 --- a/test/quality/gate.py +++ b/test/quality/gate.py @@ -90,6 +90,17 @@ class bcolors: UNDERLINE = '\033[4m' RESET = '\033[0m' +if not sys.stdout.isatty(): + bcolors.HEADER = "" + bcolors.OKBLUE = "" + bcolors.OKCYAN = "" + bcolors.OKGREEN = "" + bcolors.WARNING = "" + bcolors.FAIL = "" + bcolors.BOLD = "" + bcolors.UNDERLINE = "" + bcolors.RESET = "" + def show_results_used(results: list[artifact.ScanResult]): print(f" Results used:") for idx, result in enumerate(results):