Skip to content

Instantly share code, notes, and snippets.

@mp911de
Last active December 1, 2016 14:10
Show Gist options
  • Select an option

  • Save mp911de/a676680ccfb3a6671c64d6f1d7af699c to your computer and use it in GitHub Desktop.

Select an option

Save mp911de/a676680ccfb3a6671c64d6f1d7af699c to your computer and use it in GitHub Desktop.
#!/bin/bash
###################################################################################
# Run this script in your project. It will process all files below src/test/java.
###################################################################################
files=$(grep -lR "@see" src/test/java | grep .java$)
for file in $files
do
grep -E "@see [A-Z]+\-[0-9]+" $file \
&& echo $file \
&& perl -0777 -i -pe 's/\/\*{1,2}[\s]+\* \@see (([A-Z]+\-[0-9]+(, )?)+)([\s]+\*){1,2}\/[\s]+((\@[^T][\w]+.*[\s]+)?\@Test(\([^\)]+\))?)/$5 \/\/ $1/gm' $file
grep -E "@see [A-Z]+\-[0-9]+" $file \
&& perl -0777 -i -pe 's/\/\*{1,2}[\s]+\* \@see ([A-Z]+\-[0-9]+)([\s]+\*){1,2}\//\/\/ $1/gm' $file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment