Skip to content

Commit

Permalink
ENH: execute formatter hooks first (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer authored Jan 20, 2024
1 parent 321f419 commit c7b3d7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 5 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ repos:
hooks:
- id: blacken-docs

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier

- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.3.0
hooks:
Expand All @@ -91,12 +96,6 @@ repos:
require_serial: true
types:
- python

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier

- repo: https://github.com/ComPWA/mirrors-pyright
rev: v1.1.345
hooks:
Expand Down
6 changes: 5 additions & 1 deletion src/compwa_policy/check_dev_files/precommit.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ def __repo_sort_key(repo: Repo) -> tuple[int, str]:
return 1, repo_url
if len(hooks) > 1:
return 2, repo_url
return 3, hooks[0]["id"]
hook_id = hooks[0]["id"]
formatter_hooks = {"black", "blacken-docs", "isort", "prettier"}
if hook_id in formatter_hooks:
return 3, hook_id
return 4, hook_id


def _update_precommit_ci_commit_msg() -> None:
Expand Down

0 comments on commit c7b3d7b

Please sign in to comment.