From 10f4b229de3d4c2f47a971ecc334921368d28fb7 Mon Sep 17 00:00:00 2001 From: bashonly Date: Sun, 12 May 2024 11:21:46 -0500 Subject: [PATCH] Add separate `pre-commit` config for `hatch` Authored by: bashonly --- .pre-commit-config.yaml | 11 ++++++++--- .pre-commit-hatch.yaml | 8 ++++++++ pyproject.toml | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 .pre-commit-hatch.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d50e1bfda..dc5a520b4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,13 @@ repos: - repo: local hooks: - - id: fix - name: Apply code fixes - entry: hatch fmt + - id: linter + name: Apply linter fixes + entry: ruff check --fix . + language: system + types: [python] + - id: format + name: Apply formatting fixes + entry: autopep8 --in-place . language: system types: [python] diff --git a/.pre-commit-hatch.yaml b/.pre-commit-hatch.yaml new file mode 100644 index 000000000..d50e1bfda --- /dev/null +++ b/.pre-commit-hatch.yaml @@ -0,0 +1,8 @@ +repos: +- repo: local + hooks: + - id: fix + name: Apply code fixes + entry: hatch fmt + language: system + types: [python] diff --git a/pyproject.toml b/pyproject.toml index 37ec5c3da..32ff9909a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -136,7 +136,7 @@ dependencies = ["pre-commit"] path = ".venv" [tool.hatch.envs.default.scripts] -setup = "pre-commit install" +setup = "pre-commit install --config .pre-commit-hatch.yaml" yt-dlp = "python -Werror -Xdev -m yt_dlp {args}" [tool.hatch.envs.hatch-static-analysis]