mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-31 15:48:22 +00:00
Format Function definitions (#4951)
This commit is contained in:
parent
07cc4bcb0f
commit
68969240c5
79 changed files with 2601 additions and 1223 deletions
|
@ -77,6 +77,11 @@ for group, group_nodes in nodes_grouped.items():
|
|||
# )
|
||||
# src.joinpath(groups[group]).joinpath("mod.rs").write_text(rustfmt(mod_section))
|
||||
for node in group_nodes:
|
||||
node_path = src.joinpath(groups[group]).joinpath(f"{to_camel_case(node)}.rs")
|
||||
# Don't override existing manual implementations
|
||||
if node_path.exists():
|
||||
continue
|
||||
|
||||
code = f"""
|
||||
use crate::{{verbatim_text, FormatNodeRule, PyFormatter}};
|
||||
use ruff_formatter::{{write, Buffer, FormatResult}};
|
||||
|
@ -91,9 +96,8 @@ for group, group_nodes in nodes_grouped.items():
|
|||
}}
|
||||
}}
|
||||
""".strip() # noqa: E501
|
||||
src.joinpath(groups[group]).joinpath(f"{to_camel_case(node)}.rs").write_text(
|
||||
rustfmt(code)
|
||||
)
|
||||
|
||||
node_path.write_text(rustfmt(code))
|
||||
|
||||
# %%
|
||||
# Generate `FormatRule`, `AsFormat` and `IntoFormat`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue