Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: add more excludes to toml-sort hook #207

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
repo="https://github.com/pappasam/toml-sort",
hooks=[CommentedMap(id="toml-sort", args=["--in-place"])],
)
excludes = []

Check warning on line 77 in src/repoma/check_dev_files/toml.py

View check run for this annotation

Codecov / codecov/patch

src/repoma/check_dev_files/toml.py#L77

Added line #L77 was not covered by tests
if glob("labels/*.toml"):
expected_hook["hooks"][0]["exclude"] = r"(?x)^(labels/.*\.toml)$"
excludes.append(r"labels/.*\.toml")

Check warning on line 79 in src/repoma/check_dev_files/toml.py

View check run for this annotation

Codecov / codecov/patch

src/repoma/check_dev_files/toml.py#L79

Added line #L79 was not covered by tests
if glob("labels*.toml"):
excludes.append(r"labels.*\.toml")

Check warning on line 81 in src/repoma/check_dev_files/toml.py

View check run for this annotation

Codecov / codecov/patch

src/repoma/check_dev_files/toml.py#L81

Added line #L81 was not covered by tests
if excludes:
excludes = sorted(excludes, key=str.lower)
expected_hook["hooks"][0]["exclude"] = "(?x)^(" + "|".join(excludes) + ")$"

Check warning on line 84 in src/repoma/check_dev_files/toml.py

View check run for this annotation

Codecov / codecov/patch

src/repoma/check_dev_files/toml.py#L83-L84

Added lines #L83 - L84 were not covered by tests
update_single_hook_precommit_repo(expected_hook)


Expand Down
Loading