Brute force ftw

I write dumb scripts with git! Here’s how to (slowly / automatically) remove any @SuppressWarnings annotations that don’t do anything:

for i in `grep -rl @SuppressWarnings src` ; do
echo $i
cp $i $i.tmp
grep -v "@SuppressWarnings" $i.tmp > $i
rm $i.tmp
git-commit -a -m "Disable warning suppressions for $i"
ant compile > build.txt

res=`grep "[javac].*error" build.txt || 
grep "[javac].*warning" build.txt`

if [[ ! -z $res ]]; then
echo error!
git-reset --hard HEAD~1
fi
done

Comments are closed.