mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-08 05:35:10 +00:00
17 lines
436 B
Python
17 lines
436 B
Python
import re
|
|
from pathlib import Path
|
|
|
|
ROOT_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
|
|
def dir_name(linter_name: str) -> str:
|
|
return linter_name.replace("-", "_")
|
|
|
|
|
|
def pascal_case(linter_name: str) -> str:
|
|
"""Convert from snake-case to PascalCase."""
|
|
return "".join(word.title() for word in linter_name.split("-"))
|
|
|
|
|
|
def get_indent(line: str) -> str:
|
|
return re.match(r"^\s*", line).group() # type: ignore[union-attr]
|