-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix: test all file #3
Conversation
@xamcost Forgot the commits name it was just supposed to be a test at the beginning. |
for file in $(find . -name "*.jsonld"); do | ||
printf "Checking $file .. " | ||
jq empty $file && echo "OK" | ||
jq empty $file || exit 1 | ||
echo "OK" | ||
done || exit 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thomasBousselin My bad, my implementation was indeed not exiting with an error if another file than the last one was invalid, sorry about that! Your implementation correct that! However, it stops the loop at the first encountered error, which means that other file would not be checked once one is invalid. My original intention was to check all files and exit with an error if any error is encountered in the loop, but I was wrong. Another way to actually do this would be to build on your solution but exit only with a final check, like this:
error=0
for file in $(find . -name "*.jsonld"); do
printf "Checking $file .. "
jq empty $file && echo "OK" || error=1
done
exit $error
That way, all files are checked, even if the first one is invalid, and the code exits with an error if at least one error got raised in the loop. What do you think ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is better. I have added an echo in case of error for readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for this work @thomasBousselin , and for the thorough testing! Have a nice week end ✨
You to |
The previous pipeline only tested the last file