<commit_before>#!/bin/bash
# Find the directory we exist within
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd ${DIR}

tmp=$(mktemp)

echo "checking tools"
if [ ! -r ../docs/tools.md ]; then
	echo "docs/tools.md not a readable file?"
	exit 2
fi
./tools-to-doc.sh > $tmp
diff ../docs/tools.md $tmp
ret=$?
[ $ret -gt 0 ] && exit $ret

echo "checking configs"
if [ ! -r ../docs/config.md ]; then
	echo "docs/config.md not a readable file?"
	exit 2
fi
./config-to-doc.sh > $tmp
diff ../docs/config.md $tmp

# metrics2docs .> docs/metrics.md this doesn't work very well yet<commit_msg>rm tmp file + be explicit wrt exit code<commit_after>#!/bin/bash
# Find the directory we exist within
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd ${DIR}

tmp=$(mktemp)

echo "checking tools"
if [ ! -r ../docs/tools.md ]; then
	echo "docs/tools.md not a readable file?"
	exit 2
fi
./tools-to-doc.sh > $tmp
diff ../docs/tools.md $tmp
ret=$?
rm $tmp
[ $ret -gt 0 ] && exit $ret

echo "checking configs"
if [ ! -r ../docs/config.md ]; then
	echo "docs/config.md not a readable file?"
	exit 2
fi
./config-to-doc.sh > $tmp
diff ../docs/config.md $tmp
ret=$?
rm $tmp
exit $ret

# metrics2docs .> docs/metrics.md this doesn't work very well yet
{'fraction_non_alphanumeric': 0.18159806295399517, 'fraction_numerical': 0.008071025020177562, 'mean_word_length': 3.2465753424657535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3492915', 'n_tokens_mistral': 496, 'n_tokens_neox': 458, 'n_words': 155}