From 57297a2f9cdaeec0e667230ee8228c0c74faf366 Mon Sep 17 00:00:00 2001 From: Arild Matsson Date: Wed, 18 Sep 2024 16:48:32 +0200 Subject: [PATCH] docs: improve metrics script, add graphs --- scripts/stats-assemble.sh | 7 +++---- scripts/stats-get.sh | 2 +- scripts/stats-graphs.sh | 11 +++++++++++ scripts/stats-run.sh | 8 ++++++++ 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100755 scripts/stats-graphs.sh create mode 100755 scripts/stats-run.sh diff --git a/scripts/stats-assemble.sh b/scripts/stats-assemble.sh index f68c48e4b..304feafbb 100755 --- a/scripts/stats-assemble.sh +++ b/scripts/stats-assemble.sh @@ -3,13 +3,12 @@ DIR=$(dirname "$0") # CSV header corresponding to lines in the metrics -echo "Commit,Version,Date,TS,JS,TS%,lib,test,Dependencies,window,Directives,Components" +echo "Commit,Version,Date,TS,JS,TS%,RepoSize,LibSize,TestLoc,Deps,Window,Directives,Components" # Check out each tagged version and run metrics -# Skip v6.x, it had lots of dependencies checked in -for TAG in $(git tag | grep -v 'v6'); do +for TAG in $(git tag); do git checkout -q "$TAG" DATE=$(git show --no-patch --format=%cs) # Output as CSV rows - "$DIR"/fe-stats-get.sh -q | paste -sd , - + "$DIR"/stats-get.sh -q | paste -sd , - done diff --git a/scripts/stats-get.sh b/scripts/stats-get.sh index 3b1b753b5..e6fe70c16 100755 --- a/scripts/stats-get.sh +++ b/scripts/stats-get.sh @@ -33,7 +33,7 @@ label "JavaScript lines of code" $WC_JS label "Ratio of TypeScript" $TS_RATIO% label "Size of repo (KB)" -git ls-files | xargs du --apparent-size -c | tail -n1 | cut -f1 +git ls-files -z | xargs -0 du --apparent-size -c | tail -n1 | cut -f1 label "Size of lib/ (KB)" du --apparent-size -s app/lib/ | cut -f1 diff --git a/scripts/stats-graphs.sh b/scripts/stats-graphs.sh new file mode 100755 index 000000000..778050a9a --- /dev/null +++ b/scripts/stats-graphs.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Lines in JS/TS files +cat ../fe-stats.csv | qsvlite select Date,JS,TS | graph - --xcol 1 --yrange 0:40000 --ylabel Lines -o ../fe-stats-ts.png + +# Size (KB) of full repo vs lib/ +cat ../fe-stats.csv | qsvlite select Date,RepoSize,LibSize | qsvlite slice -s 2 | graph - -x 1 --ylabel KB -o ../fe-stats-size.png + +# Counts of direct dependences, global window vars, AngularJS Directives and Components +cat ../fe-stats.csv | qsvlite select Date,Deps,Window,Directives,Components | graph - --xcol 1 --ylabel Count -o ../fe-stats-count.png + diff --git a/scripts/stats-run.sh b/scripts/stats-run.sh new file mode 100755 index 000000000..3802efc5b --- /dev/null +++ b/scripts/stats-run.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +DIR=$(dirname $0) +cd "$DIR"/.. +cp scripts/*.sh . +./stats-assemble.sh > ../fe-stats.csv +./stats-graphs.sh +git checkout code-metrics