mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
check-templates: Make --fix fix all files.
The 0/1 convention confused the person who implemented the --fix option. Now we use bools.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user