Skip to content

Commit

Permalink
ENH: add more excludes to toml-sort hook
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Oct 9, 2023
1 parent 066f059 commit d061298
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/repoma/check_dev_files/toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,14 @@ def _update_tomlsort_hook() -> None:
repo="https://github.com/pappasam/toml-sort",
hooks=[CommentedMap(id="toml-sort", args=["--in-place"])],
)
excludes = []
if glob("labels/*.toml"):
expected_hook["hooks"][0]["exclude"] = r"(?x)^(labels/.*\.toml)$"
excludes.append(r"labels/.*\.toml")
if glob("labels*.toml"):
excludes.append(r"labels.*\.toml")
if excludes:
excludes = sorted(excludes, key=str.lower)
expected_hook["hooks"][0]["exclude"] = "(?x)^(" + "|".join(excludes) + ")$"
update_single_hook_precommit_repo(expected_hook)


Expand Down

0 comments on commit d061298

Please sign in to comment.