Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
Add check for incorrect yaml file extensions (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs authored Jan 22, 2024
1 parent 3ef943d commit 7079543
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
- name: Lint repository
run: pre-commit run --all-files

- name: Check for bad file extensions
run: invoke check-for-yaml

validate:

runs-on: ubuntu-latest
Expand Down
25 changes: 25 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,28 @@ def validate_entries(_):
print(f"Loaded {counts[type_]} {type_.__name__} entries")

print("Done!")


@task
def check_for_yaml(_):
from pathlib import Path

print("Checking for erroneous .yaml files.")

extractors = list(
Path(__file__).parent.glob("./marda_registry/data/extractors/*.yaml")
)
filetypes = list(
Path(__file__).parent.glob("./marda_registry/data/filetypes/*.yaml")
)

for e in extractors:
print(f"Found {e} with bad file extension (should be .yml here)")

for f in filetypes:
print(f"Found {f} with bad file extension (should be .yml here)")

if extractors or filetypes:
raise RuntimeError(f"Found files with bad extensions: {filetypes} {extractors}")

print("Done!")

0 comments on commit 7079543

Please sign in to comment.