mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
[refurb
] Implement write-whole-file
(FURB103
) (#10802)
## Summary Implement `write-whole-file` (`FURB103`), part of #1348. This is largely a copy and paste of `read-whole-file` #7682. ## Test Plan Text fixture added. --------- Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
This commit is contained in:
parent
ac14d187c6
commit
ffea1bb0a3
11 changed files with 640 additions and 189 deletions
|
@ -27,9 +27,7 @@ def main(*, name: str, prefix: str, code: str, linter: str) -> None:
|
|||
/ "crates/ruff_linter/resources/test/fixtures"
|
||||
/ dir_name(linter)
|
||||
/ f"{filestem}.py"
|
||||
).open(
|
||||
"a",
|
||||
):
|
||||
).open("a"):
|
||||
pass
|
||||
|
||||
plugin_module = ROOT_DIR / "crates/ruff_linter/src/rules" / dir_name(linter)
|
||||
|
@ -141,7 +139,7 @@ pub(crate) fn {rule_name_snake}(checker: &mut Checker) {{}}
|
|||
variant = pascal_case(linter)
|
||||
rule = f"""rules::{linter.split(" ")[0]}::rules::{name}"""
|
||||
lines.append(
|
||||
" " * 8 + f"""({variant}, "{code}") => (RuleGroup::Stable, {rule}),\n""",
|
||||
" " * 8 + f"""({variant}, "{code}") => (RuleGroup::Preview, {rule}),\n""",
|
||||
)
|
||||
lines.sort()
|
||||
text += "".join(lines)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue