Created
September 25, 2018 11:03
-
-
Save timfeirg/348036656329e2b5f2a3076ee979d70b to your computer and use it in GitHub Desktop.
analyse unused class and functions (using ag)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
target_directory=${1-.} | |
export IFS=' | |
' | |
for target in $(ag -o '((class|def)\s+(\w+))'); do | |
target_name=$(echo $target | ag -o '\w+$') | |
occurance=$(ag -Q $target_name $target_directory --py | wc -l) | |
if [ $occurance -eq 1 ]; then | |
echo $target | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment