From d565387657c6237a0ad71927582a6688038b4398 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Wed, 24 Nov 2021 14:15:01 +0000 Subject: [PATCH] check-templates: Make --fix fix all files. The 0/1 convention confused the person who implemented the --fix option. Now we use bools. --- tools/lib/pretty_print.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/lib/pretty_print.py b/tools/lib/pretty_print.py index ec4fb7c77c..585acd6929 100644 --- a/tools/lib/pretty_print.py +++ b/tools/lib/pretty_print.py @@ -197,7 +197,7 @@ def pretty_print_html(html: str) -> str: return "\n".join(formatted_lines) -def validate_indent_html(fn: str, fix: bool) -> int: +def validate_indent_html(fn: str, fix: bool) -> bool: with open(fn) as f: html = f.read() phtml = pretty_print_html(html) @@ -206,8 +206,8 @@ def validate_indent_html(fn: str, fix: bool) -> int: print(GREEN + "Automatically fixing problems..." + ENDC) with open(fn, "w") as f: f.write(phtml) - # Since we successfully fixed the issues, we exit with status 0 - return 0 + # Since we successfully fixed the issues, we return True. + return True print( "Invalid indentation detected in file: " f"{fn}\nDiff for the file against expected indented file:", @@ -216,5 +216,5 @@ def validate_indent_html(fn: str, fix: bool) -> int: subprocess.run(["diff", fn, "-"], input=phtml, universal_newlines=True) print() print("This problem can be fixed with the `--fix` option.") - return 0 - return 1 + return False + return True