Repository navigation
fix(format): keep function spacing around characters and metadata - #969
Conversation
…tadata Signed-off-by: hiyouwhatsapp <[email protected]>
|
Thanks for the fixes! The changes address both issues, and the added regression tests provide good coverage. Before merging, could you please check two additional edge cases?
Please also ensure that these cases preserve formatting idempotency. Once these are addressed and the tests pass, this should be ready to merge. Thanks! |
Signed-off-by: hiyouwhatsapp <[email protected]>
Signed-off-by: hiyouwhatsapp <[email protected]>
|
Apologies for the hiatus, fixed |
Fixes #888
Fixes #891
After a literal like
'a', the helper could treat the closing quote as the start of another character and miss the next function. It now checks for that closing quote before deciding that a name is a lifetimeThe other part was the gap before a function. Attributes, docs and attached comments now stay with that function, with the blank line inserted before them. Unrelated items and comments already separated from the function keep their place
Added cases for escaped and byte characters, Unicode, lifetimes and loop labels, multiline attributes and comments, and methods inside an impl. The tests also check that formatting twice gives the same result
Testing:
PYTHONUTF8=1 python -m unittest tools.test_case_manifest tools.test_test_contracts tools.test_process_tree tools.test_format_rustpasses on Windows with Python 3.13 — 60 tests run, 58 passed and 2 POSIX-only tests skipped. Earlier runs of the unchanged process-tree tests had timing failures under the concurrent test workload; the isolated run and final combined run passAlso checked all 220 tracked Rust files: formatting is idempotent and every nonblank line is preserved. The updated helper finds spacing gaps in 17 files; I haven't included a repository-wide reformat here.
git diff --checkpasses. Full Rust workspace and Wave language corpus checks weren't run for this Python tooling changeCommits include the DCO sign-off