Skip to content

Commit

Permalink
travis: reject invalid UUIDs (#862)
Browse files Browse the repository at this point in the history
Want to prevent any invalid UUIDs from being entered.

Want to put this in configlet lint, but can't:
exercism/configlet#99
exercism/configlet#168
So it will go in individual tracks' .travis.yml for now.

It appears that the site will accept pretty much arbitrary strings as
UUIDs for now, but we want to make less work for ourselves when valid
UUIDs are required.
  • Loading branch information
petertseng authored Aug 31, 2019
1 parent 62a872c commit e79e43f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ script:
- "./_test/check-configlet-fmt.sh"
- "sh ./_test/ensure-readmes-are-updated.sh"
- "./bin/configlet lint ."
- "sh ./_test/check-uuids.sh"
- "./_test/verify-exercise-difficulties.sh"
- "./_test/check-exercises-for-authors.sh"
- "sh ./_test/check-exercise-crate.sh"
Expand Down
13 changes: 13 additions & 0 deletions _test/check-uuids.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

repo=$(cd "$(dirname "$0")/.." && pwd)

# Check for invalid UUIDs.
# can be removed once `configlet lint` gains this ability.
# Check issue https://github.com/exercism/configlet/issues/99
bad_uuid=$(jq --raw-output '.exercises | map(.uuid) | .[]' $repo/config.json | grep -vE '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$')
if [ -n "$bad_uuid" ]; then
echo "invalid UUIDs found! please correct these to be valid UUIDs:"
echo "$bad_uuid"
exit 1
fi

0 comments on commit e79e43f

Please sign in to comment.