mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 05:26:23 +00:00
![]() * Document codes.rs * Refactor codes.rs before merging Helper script: ```python # %% from pathlib import Path codes = Path("crates/ruff/src/codes.rs").read_text().splitlines() rules = Path("a.txt").read_text().strip().splitlines() rule_map = {i.split("::")[-1]: i for i in rules} # %% codes_new = [] for line in codes: if ", Rule::" in line: left, right = line.split(", Rule::") right = right[:-2] line = left + ", " + rule_map[right] + ")," codes_new.append(line) # %% Path("crates/ruff/src/codes.rs").write_text("\n".join(codes_new)) ``` Co-authored-by: Jonathan Plasse <13716151+JonathanPlasse@users.noreply.github.com> |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |