Added a check for file extension.

3 recipes recently have been submitted with missing file extensions, so
now we can catch those easier.
This commit is contained in:
Steven Hall 2021-03-29 16:58:42 -07:00
parent 4af79b651f
commit 97b828a82f

View File

@ -61,6 +61,8 @@ check_recipe() {
} }
while IFS= read -r file; do while IFS= read -r file; do
errMsgs=''
# If the file doesn't exist, then the user probably deleted it, so don't # If the file doesn't exist, then the user probably deleted it, so don't
# check it. # check it.
# This will also ignore things that aren't files, like if someone adds a # This will also ignore things that aren't files, like if someone adds a
@ -77,6 +79,9 @@ while IFS= read -r file; do
example.md) ;; example.md) ;;
README.md) ;; README.md) ;;
.github/*.md) ;; .github/*.md) ;;
LICENSE) ;;
Makefile) ;;
config) ;;
*.webp) *.webp)
errMsgs="$(check_image "$file")" errMsgs="$(check_image "$file")"
@ -84,6 +89,15 @@ while IFS= read -r file; do
*.md) *.md)
errMsgs="$(check_recipe "$file")" errMsgs="$(check_recipe "$file")"
;; ;;
*.*)
# Catch any other file with an extension and don't do anything
# special
;;
*)
# Catch anything else (ie, any file without an extension)
errMsgs="File doesn't have a file extension. If this is a recipe, add '.md' to the end of this filename.";
;;
esac esac
if [ -n "$errMsgs" ]; then if [ -n "$errMsgs" ]; then