Skip to content

Commit

Permalink
DX: sort toml-sort and taplo as formatters
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Jan 20, 2024
1 parent eb0e77d commit 66d9e9c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
27 changes: 14 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ repos:
hooks:
- id: prettier

- repo: https://github.com/ComPWA/mirrors-taplo
rev: v0.8.1
hooks:
- id: taplo

- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
hooks:
- id: toml-sort
args:
- --in-place
exclude: (?x)^(labels/.*\.toml)$

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

- repo: https://github.com/ComPWA/mirrors-pyright
rev: v1.1.345
hooks:
Expand All @@ -106,16 +120,3 @@ repos:
hooks:
- id: ruff
args: [--fix]

- repo: https://github.com/ComPWA/mirrors-taplo
rev: v0.8.1
hooks:
- id: taplo

- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
hooks:
- id: toml-sort
args:
- --in-place
exclude: (?x)^(labels/.*\.toml)$
9 changes: 8 additions & 1 deletion src/compwa_policy/check_dev_files/precommit.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ def __repo_sort_key(repo: Repo) -> tuple[int, str]:
if len(hooks) > 1:
return 2, repo_url
hook_id = hooks[0]["id"]
formatter_hooks = {"black", "blacken-docs", "isort", "prettier"}
formatter_hooks = {

Check warning on line 60 in src/compwa_policy/check_dev_files/precommit.py

View check run for this annotation

Codecov / codecov/patch

src/compwa_policy/check_dev_files/precommit.py#L60

Added line #L60 was not covered by tests
"black",
"blacken-docs",
"isort",
"prettier",
"taplo",
"toml-sort",
}
if hook_id in formatter_hooks:
return 3, hook_id
return 4, hook_id
Expand Down

0 comments on commit 66d9e9c

Please sign in to comment.