Update .pre-commit-config.yml (#2139)

This commit is contained in:
Jonathan Plasse 2023-01-25 01:45:34 +01:00 committed by GitHub
parent 0cac1a0d21
commit 82d7814101
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 17 deletions

View file

@ -10,15 +10,14 @@ Example usage:
"""
import argparse
import os
from _utils import ROOT_DIR, dir_name, get_indent, pascal_case
def main(*, plugin: str, url: str, prefix_code: str) -> None:
"""Generate boilerplate for a new plugin."""
# Create the test fixture folder.
os.makedirs(
ROOT_DIR / "resources/test/fixtures" / dir_name(plugin),
(ROOT_DIR / "resources/test/fixtures" / dir_name(plugin)).mkdir(
exist_ok=True,
)
@ -56,7 +55,7 @@ mod tests {
}
}
"""
% dir_name(plugin)
% dir_name(plugin),
)
# Create a subdirectory for rules and create a `mod.rs` placeholder
@ -84,7 +83,7 @@ mod tests {
fp.write(f"{indent}// {plugin}")
fp.write("\n")
elif line.strip() == '/// Ruff-specific rules':
elif line.strip() == "/// Ruff-specific rules":
fp.write(f"/// [{plugin}]({url})\n")
fp.write(f'{indent}#[prefix = "{prefix_code}"]\n')
fp.write(f"{indent}{pascal_case(plugin)},")