Created
August 3, 2022 11:21
-
-
Save ehpc/6f628353d997733bb9446087629bb937 to your computer and use it in GitHub Desktop.
Get metric of how many `any`'s are there compared to line count for TypeScript codebase (in percents)
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
#!/bin/sh | |
# Calculates a metric of how many `any`'s are there compared to line count for TypeScript codebase (in percents) | |
# Basically we count all `any` occurences, then count all lines in the codebase, and lastly divide one by another | |
echo "scale = 4; $(find -name "*.ts?" -not -path "./node_modules/*" | xargs grep -o '\bany\b' | wc -l) * 100 / $(find -name "*.ts?" -not -path "./node_modules/*" | xargs wc -l | tail -1 | awk '{print $1}')" | bc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment