mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-24 01:01:40 +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>
|
||
|---|---|---|
| .. | ||
| cache_key.rs | ||
| combine_options.rs | ||
| config.rs | ||
| derive_message_formats.rs | ||
| lib.rs | ||
| map_codes.rs | ||
| newtype_index.rs | ||
| rule_code_prefix.rs | ||
| rule_namespace.rs | ||
| violation.rs | ||