Created
November 26, 2021 14:03
-
-
Save thiagocordeiro/535feba34546cd4db8c0622a7e74f5bf to your computer and use it in GitHub Desktop.
check-file-size.sh
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 | |
echo "$(git ls-files | xargs cat | wc -l | xargs) Lines of code" | |
RESULT=$(wc -l $(git ls-files) | grep .php | grep -v "tests/" | awk '{ if ( $1 > 250 ) printf("%-6s | %s \n\r", $1, $2) }') | |
if [ -n "$RESULT" ]; then | |
awk 'BEGIN {s=sprintf("%131s","");gsub(/ /,"-",s);print s}' | |
echo "LINE | FILE" | |
awk 'BEGIN {s=sprintf("%131s","");gsub(/ /,"-",s);print s}' | |
echo $RESULT | |
awk 'BEGIN {s=sprintf("%131s","");gsub(/ /,"-",s);print s}' | |
echo "There are files with more then 250 lines" | |
awk 'BEGIN {s=sprintf("%131s","");gsub(/ /,"-",s);print s}' | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment