Created
January 27, 2023 15:03
-
-
Save fernandospr/2c3f4f6a28f6bd117e3e45e620b2b3a7 to your computer and use it in GitHub Desktop.
Recursively looks for Request/Response Kotlin models that may have missing @SerializedName annotations
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
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "Recursively looks for Kotlin files having missing @SerializedName annotations." | |
echo | |
echo "Usage: $0 <directory to analyze>" | |
exit 1 | |
fi | |
currentPath=$PWD | |
cd $1 | |
files=`find $PWD -type f \( -name "*Response*.kt" -o -name "*Request*.kt" \)` | |
for file in $files | |
do | |
propertyCount=`cat $file | grep "val \|var " -c` | |
annotationCount=`cat $file | grep "SerializedName" -c` | |
if [ $propertyCount -ne $annotationCount ]; then | |
echo "$file may have missing @SerializedName annotations." | |
fi | |
done | |
cd $currentPath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment