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:
@@ -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""",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user