mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
fixes invalid rule from hyphen (#11484)
## Summary When using `add_rule.py`, it produces the following line in `codes.rs` ``` (Flake8Async, "102") => (RuleGroup::Stable, rules::flake8-async::rules::BlockingOsCallInAsyncFunction), ``` Causing a syntax error. This PR resolves that issue so that the script can be used again. ## Test Plan Tested manually in new rule creation
This commit is contained in:
parent
8848eca3c6
commit
3476e2f359
1 changed files with 2 additions and 1 deletions
|
@ -137,7 +137,8 @@ pub(crate) fn {rule_name_snake}(checker: &mut Checker) {{}}
|
|||
lines.append(line)
|
||||
|
||||
variant = pascal_case(linter)
|
||||
rule = f"""rules::{linter.split(" ")[0]}::rules::{name}"""
|
||||
linter_name = linter.split(" ")[0].replace("-", "_")
|
||||
rule = f"""rules::{linter_name}::rules::{name}"""
|
||||
lines.append(
|
||||
" " * 8 + f"""({variant}, "{code}") => (RuleGroup::Preview, {rule}),\n""",
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue