Created
April 29, 2023 17:21
-
-
Save hovsater/a0b1c26ead82e49bb9f07d23a1ba5f8c to your computer and use it in GitHub Desktop.
Poor Man's version of finding dead code (specifically Ruby constants)
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
grep -REho --include \*.rb '\b[A-Z_]+\b\s*=' . | tr -d '=' | cut -d' ' -f1 | sort | uniq -u | xargs -I{} bash -c 'if [[ $(grep -Rhow --include \*.rb "{}" . | wc -l) -eq 1 ]] ; then echo {} ; fi' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment