Created
September 23, 2019 12:11
-
-
Save jnduli/b8d76fd0f976cd686eb719f4f6e3b1b5 to your computer and use it in GitHub Desktop.
This helps find unused or rarely used functions in a php project
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
| ## This script is used to check for unused or rarely used function in php | |
| ## It has been tested on a laravel project | |
| ## It outputs a list containing all functions plus number of occurences in the project | |
| ## It can be used together with sort e.g. php_unused_functions.sh | sort -h | |
| for f in $(grep --exclude-dir=tests -rho -P '^.*public .*function .*(?=\()'| awk -F' ' '{print $NF}'); do | |
| echo $(grep -ro $f * | wc -l) $f | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment