Skip to content

Instantly share code, notes, and snippets.

@dimohamdy
Created July 23, 2023 13:13
Show Gist options
  • Save dimohamdy/c41c766a8c26afdf4b822364ccbe0877 to your computer and use it in GitHub Desktop.
Save dimohamdy/c41c766a8c26afdf4b822364ccbe0877 to your computer and use it in GitHub Desktop.
List unused code using periphery
echo "🔍 Start dead code analysis"
result="$(periphery scan --config .periphery.yml)"
current_dir=$(pwd)
result_stripped_of_absolute_path_prefix=$(echo "$result" | sed "s|$current_dir/||g")
filtered_out_result=$(echo "$result_stripped_of_absolute_path_prefix" | awk '/:[0-9]+:[0-9]+:/{ print }')
sorted_result=$(echo "$filtered_out_result" | sort)
echo "🙌 Done with dead code analysis"
echo "$sorted_result"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment