Skip to content

Commit

Permalink
Do not bother storing/returning "last dataset rc" - best output which…
Browse files Browse the repository at this point in the history
… datasets failed, exit 1 if any
  • Loading branch information
yarikoptic committed Apr 19, 2024
1 parent 560bd03 commit 4e428e8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

rc=0;
failed=

which bids-validator
if bids-validator --help | grep -q -e '--config'; then
Expand Down Expand Up @@ -41,18 +41,21 @@ for i in $(ls -d */ | grep -v node_modules); do
echo "Running " $CMD

if [ -n "$VALIDATOR_SUPPORTS_CONFIG" ]; then
$CMD || rc=$?
$CMD || failed+=" $i"
else
# rc is not returned correctly anyways and for the best since we need to ignore
# exit code is not returned correctly anyways and for the best since we need to ignore
# ref: https://github.com/bids-standard/bids-validator/issues/1909
# NOTE: limit to 1 file per error to not flood screen!
errors=$($CMD 2>/dev/null \
| jq '(.issues | map(select(.severity == "error" and .key != "EMPTY_FILE"))) | map(.files_1 = (.files | if length > 0 then .[0:1] else empty end) | del(.files)) | if length > 0 then . else empty end' \
)
if [ -n "$errors" ]; then
echo -e "$errors" | sed -e 's,^, ,g'
rc=1
failed+=" $i"
fi
fi
done
exit $rc;
if [ -n "$failed" ]; then
echo "Datasets failed validation: $failed"
exit 1
fi

0 comments on commit 4e428e8

Please sign in to comment.