diff --git a/spiffworkflow-backend/bin/codemod/remove_all_unused_functions b/spiffworkflow-backend/bin/codemod/remove_all_unused_functions index 2d51f00d..b0686eda 100755 --- a/spiffworkflow-backend/bin/codemod/remove_all_unused_functions +++ b/spiffworkflow-backend/bin/codemod/remove_all_unused_functions @@ -16,6 +16,8 @@ fi list_of_unused_things="$(dead | grep -E '^[a-z].*is never read')" +filename_patterns_to_ignore="(codemod|migrations/versions|conftest.py|noxfile.py)" + while read -r line; do function_name="$(echo "$line" | awk '{print $1}')" echo "possible function_name: ${function_name}" @@ -25,8 +27,8 @@ while read -r line; do echo "skipping $function_name in ${file_name} because it's not a function" continue fi - if grep -E codemod <<< "$file_name" >/dev/null 2>&1; then - echo "skipping ${file_name} because it's a codemod file" + if grep -E "$filename_patterns_to_ignore" <<< "$file_name" >/dev/null 2>&1; then + echo "skipping ${file_name} because it's in the list of files to ignore (probably because it is a false positive and actually used)" continue fi echo "trying to remove $function_name from: ${file_name}"