mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-07-14 10:02:27 +03:00
Update Ruff version pre-commit config
This commit is contained in:
parent
df7b957853
commit
f217637d6c
|
@ -27,7 +27,7 @@ repos:
|
||||||
args: ["--tab-width", "2"]
|
args: ["--tab-width", "2"]
|
||||||
|
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.8.4
|
rev: v0.9.7
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix, --exit-non-zero-on-fix]
|
args: [--fix, --exit-non-zero-on-fix]
|
||||||
|
|
|
@ -8,6 +8,7 @@ import tomllib
|
||||||
ROOT = Path(__file__).parent.parent
|
ROOT = Path(__file__).parent.parent
|
||||||
TEMPLATED_ROOT = ROOT / "{{cookiecutter.project_slug}}"
|
TEMPLATED_ROOT = ROOT / "{{cookiecutter.project_slug}}"
|
||||||
REQUIREMENTS_LOCAL_TXT = TEMPLATED_ROOT / "requirements" / "local.txt"
|
REQUIREMENTS_LOCAL_TXT = TEMPLATED_ROOT / "requirements" / "local.txt"
|
||||||
|
TEMPLATE_PRE_COMMIT_CONFIG = ROOT / ".pre-commit-config.yaml"
|
||||||
PRE_COMMIT_CONFIG = TEMPLATED_ROOT / ".pre-commit-config.yaml"
|
PRE_COMMIT_CONFIG = TEMPLATED_ROOT / ".pre-commit-config.yaml"
|
||||||
PYPROJECT_TOML = ROOT / "pyproject.toml"
|
PYPROJECT_TOML = ROOT / "pyproject.toml"
|
||||||
|
|
||||||
|
@ -45,12 +46,13 @@ def update_ruff_version(old_version: str, new_version: str) -> None:
|
||||||
f"ruff=={new_version}",
|
f"ruff=={new_version}",
|
||||||
)
|
)
|
||||||
PYPROJECT_TOML.write_text(new_content)
|
PYPROJECT_TOML.write_text(new_content)
|
||||||
# Update pre-commit config
|
# Update pre-commit configs
|
||||||
new_content = PRE_COMMIT_CONFIG.read_text().replace(
|
for config_file in [PRE_COMMIT_CONFIG, TEMPLATE_PRE_COMMIT_CONFIG]:
|
||||||
|
new_content = config_file.read_text().replace(
|
||||||
f"repo: https://github.com/astral-sh/ruff-pre-commit\n rev: v{old_version}",
|
f"repo: https://github.com/astral-sh/ruff-pre-commit\n rev: v{old_version}",
|
||||||
f"repo: https://github.com/astral-sh/ruff-pre-commit\n rev: v{new_version}",
|
f"repo: https://github.com/astral-sh/ruff-pre-commit\n rev: v{new_version}",
|
||||||
)
|
)
|
||||||
PRE_COMMIT_CONFIG.write_text(new_content)
|
config_file.write_text(new_content)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user