From 3aa4da2756bd5fcd3f8c7173d941bd5664b3efc7 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 6 Feb 2025 23:17:27 +0000 Subject: [PATCH] Improve tidy output Print a better diff when lists are unsorted, and always check tidy lists even if `--check` is not passed. --- library/compiler-builtins/libm/etc/update-api-list.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/library/compiler-builtins/libm/etc/update-api-list.py b/library/compiler-builtins/libm/etc/update-api-list.py index 9cf625554223..c0b6e41d3002 100755 --- a/library/compiler-builtins/libm/etc/update-api-list.py +++ b/library/compiler-builtins/libm/etc/update-api-list.py @@ -278,8 +278,8 @@ def ensure_sorted(fpath: Path, block_start_line: int, lines: list[str]) -> None: """Ensure that a list of lines is sorted, otherwise print a diff and exit.""" relpath = fpath.relative_to(ROOT_DIR) diff_and_exit( - "".join(lines), - "".join(sorted(lines)), + "\n".join(lines), + "\n".join(sorted(lines)), f"sorted block at {relpath}:{block_start_line}", ) @@ -338,8 +338,7 @@ def ensure_updated_list(check: bool) -> None: crate.write_function_list(check) crate.write_function_defs(check) - if check: - crate.tidy_lists() + crate.tidy_lists() def main():