mirror of
https://github.com/astral-sh/ruff
synced 2026-01-08 15:14:19 -05:00
Improve add_rule.py and add_plugin.py scripts (#3725)
This commit is contained in:
@@ -13,5 +13,12 @@ def pascal_case(linter_name: str) -> str:
|
||||
return "".join(word.title() for word in linter_name.split("-"))
|
||||
|
||||
|
||||
def snake_case(name: str) -> str:
|
||||
"""Convert from PascalCase to snake_case."""
|
||||
return "".join(
|
||||
f"_{word.lower()}" if word.isupper() else word for word in name
|
||||
).lstrip("_")
|
||||
|
||||
|
||||
def get_indent(line: str) -> str:
|
||||
return re.match(r"^\s*", line).group() # type: ignore[union-attr]
|
||||
|
||||
Reference in New Issue
Block a user