Last active
February 12, 2018 22:15
-
-
Save bspaulding/786e73a98e7450aaa212 to your computer and use it in GitHub Desktop.
codebase metrics
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
# use noglob on zsh | |
# change file extensions where appropriate | |
# collect source file paths for analysis | |
find . -name "*.js" | grep -v "bower_components" | grep -v "node_modules" > source_files.txt | |
# number of files in project | |
wc -l source_files.txt | |
# number of lines by file | |
cat source_files.txt | xargs wc -l | sort -r | less | |
# number of commits by file | |
# since beginning of history | |
cat source_files.txt | parallel --progress "git log --follow --oneline {} | wc -l | xargs -I {count} echo {count} {} >> commits-by-file.txt" | |
cat commits-by-file.txt | sort -r -n | |
# last month | |
cat source_files.txt | parallel --progress "git log --follow --oneline --after={1.month.ago} {} | wc -l | xargs -I {count} echo {count} {} >> commits-by-file-last-month.txt" | |
cat commits-by-file-last-month.txt | sort -r -n | |
# last quarter | |
cat source_files.txt | parallel --progress "git log --follow --oneline --after={3.months.ago} {} | wc -l | xargs -I {count} echo {count} {} >> commits-by-file-last-quarter.txt" | |
cat commits-by-file-last-quarter.txt | sort -r -n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment