Bug fixes in bin/find-invalid-json.sh

It incorrectly calculated the number of invalid JSON files.

Redirect jparse stderr to /dev/null as the script will be able to tell
without the extra clutter.
This commit is contained in:
Cody Boone Ferguson committed 2024-10-20 16:14:59 -07:00
1 parent 4e9b4db634
commit dfe89febaa
1 file changed
+1 -2
+1 -2
View File
@@ -207,7 +207,7 @@ find . -name '*.json' -print |
# get name of each JSON file
while read -r JSON_FILE; do
# try parsing JSON file
if ! "$JPARSE" "$JSON_FILE"; then
if ! "$JPARSE" "$JSON_FILE" 2>/dev/null; then
echo "$JSON_FILE is invalid JSON"
fi
# this writes the invalid JSON files to the temporary error file
@@ -217,7 +217,6 @@ done > "$TMP_INVALID_JSON"
#
INVALID_JSON_COUNT=$(wc -l < "$TMP_INVALID_JSON" | tr -d ' ')
export INVALID_JSON_COUNT
((INVALID_JSON_COUNT=INVALID_JSON_COUNT/4))
# report on any invalid JSON files