by polygot · 8y ago · 0 comments
TOTAL_CHANGES="$(git log --all --numstat --pretty="%H" | awk 'NF==3 {plus+=$1; minus+=$2} NF==1 {total++} END {printf("%d\n", plus+minus)}')"
TOTAL_LINES="$(cloc . | tail -n 2 | head -n 1 | awk '{print $NF}')"
echo "scale=2 ; $TOTAL_CHANGES / $TOTAL_LINES" | bc
echo -n ":1"
pwd
One snippet from https://gist.github.com/sephiroth74/d3ce654dcaefe1d2c4cd (modified)
How to run:
1. Clone a Git repo
2. cd into it
3. run bash ../script.sh
Output something like this:
polygot@server:~/tinkerpop$ bash ../script.sh
14.17:1/home/polygot/tinkerpop
Here's a sample of some ratios from random git repos:
158.25:jgthms/bulma
2.37:dthree/cash
32.49:Rochester-NRT/AlphaGo
7.04:apple/swift
5.00:robbyrussell/oh-my-zsh
108.86:github/gitignore
10.17:facebook/draft-js
12.77:matryer/bitbar
7.47:Microsoft/vscode
9.42:ptmt/react-native-desktop
6.06:p-e-w/maybe
1.00:parkjs814/AlgorithmVisualizer
9.54:hollance/swift-algorithm-club
17.63:alexjc/neural-doodle
4.55:fbsamples/f8app
8.80:nodejs/node
10.64:jiahaog/nativefier
325.12:Microsoft/CNTK
28.56:atom/atom
3.21:jcjohnson/neural-style
40.01:tensorflow/models