Last active
July 24, 2023 16:19
-
-
Save drewbrokke/5397f1166cfd4d828d93ff2664478411 to your computer and use it in GitHub Desktop.
This file contains 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/bash | |
function detect_unused_paths() { | |
local file | |
file="$1" | |
base_file_name="$(basename "${file%%.path}")" | |
for i in $(rg '<td>([A-Z_]+)</td>' --replace='$1' --no-line-number --no-filename --no-heading --only-matching -- "${file}") ; do | |
git --no-pager grep --quiet "\"${base_file_name}#${i}\"" -- '*.macro' '*.function' '*.testcase' || echo "${base_file_name}#${i}" | |
done | |
} | |
unused_file="unused_paths.txt" | |
echo "" > "${unused_file}" | |
for f in $(git ls-files -- '*.path') ; do | |
echo "checking ${f}..." | |
detect_unused_paths "$f" >> "${unused_file}" | |
done | |
echo "Done! See ${unused_file}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment