Skip to content

Commit

Permalink
chore: in quality tests, only colorize quality output if in a tty (#1398
Browse files Browse the repository at this point in the history
)

Permit piping "make validate" (from test/quality) to a file without filling it with control
characters.

Signed-off-by: Will Murphy <[email protected]>
  • Loading branch information
willmurphyscode committed Jul 24, 2023
1 parent e3be491 commit 5ee6bf4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/quality/gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 5ee6bf4

Please sign in to comment.