Skip to content

Commit

Permalink
docs: improve metrics script, add graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
arildm committed Oct 14, 2024
1 parent 1fe4f23 commit 57297a2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
7 changes: 3 additions & 4 deletions scripts/stats-assemble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion scripts/stats-get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions scripts/stats-graphs.sh
Original file line number Diff line number Diff line change
@@ -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

8 changes: 8 additions & 0 deletions scripts/stats-run.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 57297a2

Please sign in to comment.