misp-warninglists/validate_all.sh

45 lines
855 B
Bash
Raw Normal View History

2017-02-13 11:25:39 +01:00
#!/bin/bash
set -e
set -x
2020-04-03 13:39:18 +02:00
pushd tools
python3 make_list_unique.py
popd
2017-02-13 11:25:39 +01:00
./jq_all_the_things.sh
diffs=`git status --porcelain | wc -l`
if ! [ $diffs -eq 0 ]; then
echo "Please make sure you run ./jq_all_the_things.sh before commiting."
exit 1
fi
2017-10-29 00:50:17 +02:00
# remove the exec flag on the json files
find -name "*.json" -exec chmod -x "{}" \;
diffs=`git status --porcelain | wc -l`
if ! [ $diffs -eq 0 ]; then
echo "Please make sure you run remove the executable flag on the json files before commiting: find -name "*.json" -exec chmod -x \"{}\" \\;"
exit 1
fi
2019-03-25 11:28:17 +01:00
# test filename
for dir in lists/*/*.json
do
2019-03-25 11:34:15 +01:00
if [ `basename ${dir}` != "list.json" ]; then
2019-03-25 11:28:17 +01:00
echo "Invalid filename (should be list.json): " ${dir}
exit 1
fi
done
2017-02-13 11:25:39 +01:00
for dir in lists/*/list.json
do
echo -n "${dir}: "
jsonschema -i ${dir} schema.json
echo ''
done