Skip to content

Instantly share code, notes, and snippets.

@jack-om
Created September 10, 2020 22:13
Show Gist options
  • Select an option

  • Save jack-om/00ab3e4478b474186e9659f75bfc77eb to your computer and use it in GitHub Desktop.

Select an option

Save jack-om/00ab3e4478b474186e9659f75bfc77eb to your computer and use it in GitHub Desktop.
Quantify lines of code in a directory of git repositories.
#!/bin/bash
###########################################################
#
# Quantify a directory of git repos by measuring LoC.
# Generates report for each repo, and an aggregate report.
#
###########################################################
REPORT_DIR="_report_cloc_$(date +'%Y%m%d%H%M')"
for REPO in $(ls -d */); do
cd $REPO;
cloc --vcs git --out "../$REPORT_DIR/$REPO.cloc.txt";
cd ..
done
cloc --sum-reports --out="$REPORT_DIR/total.cloc" $(ls $REPORT_DIR/*.cloc.txt);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment