Skip to content

Commit 3e49c09

Browse files
committed
Improve tidy output
Print a better diff when lists are unsorted, and always check tidy lists even if `--check` is not passed.
1 parent 3f4d1e0 commit 3e49c09

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

etc/update-api-list.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ def ensure_sorted(fpath: Path, block_start_line: int, lines: list[str]) -> None:
278278
"""Ensure that a list of lines is sorted, otherwise print a diff and exit."""
279279
relpath = fpath.relative_to(ROOT_DIR)
280280
diff_and_exit(
281-
"".join(lines),
282-
"".join(sorted(lines)),
281+
"\n".join(lines),
282+
"\n".join(sorted(lines)),
283283
f"sorted block at {relpath}:{block_start_line}",
284284
)
285285

@@ -338,8 +338,7 @@ def ensure_updated_list(check: bool) -> None:
338338
crate.write_function_list(check)
339339
crate.write_function_defs(check)
340340

341-
if check:
342-
crate.tidy_lists()
341+
crate.tidy_lists()
343342

344343

345344
def main():

0 commit comments

Comments
 (0)