Warn about open todos on major release

During this early development I love hacking down
half finished unpolished code with open todos
and then mark them with a TODO comment

Then at some later point I might forget how everything
is held together by duck tape and do a 1.0.0 release

This check in the release script should avoid this mistake
and ensure that the 1.x.x and all other major releases
are what they claim to be: a finished, polished and working version
This commit is contained in:
ChillerDragon 2023-04-02 19:37:27 +02:00
parent 03cb8a5eb7
commit bffa9f70cb

View file

@ -11,6 +11,29 @@ then
exit 1
fi
function warn_todos() {
local todos=0
todos="$(grep -nri TODO twnet_parser | wc -l)"
if [ "$todos" == "0" ]
then
return
fi
echo "<============ TODOS"
echo "..."
grep --color=always -nri TODO twnet_parser | tail -n2
echo "<============ TODOS"
echo "Warning: there are $todos open todos!"
echo " doing a major release with open todos"
echo " is not recommended!"
echo "Do you really want to continue? [y/N]"
read -r -n1 yn
if ! [[ "$yn" =~ [yY] ]]
then
echo "aborting ..."
exit 0
fi
}
if ! git diff-index --quiet --cached HEAD --
then
echo "Error: dirty git working tree"
@ -119,6 +142,10 @@ then
echo " $latest_tag -> $tag_name"
exit 1
fi
if [ "$diff" == "1" ]
then
warn_todos
fi
else
echo "Error: failed to parse latest tag"
exit 1