summaryrefslogtreecommitdiffstats
path: root/third_party/rust/jsparagus/.metrics/populate_not_implemented.sh
blob: 3a6200133cf85e30612be79f9eba3ce3bcca6917 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash

set -ue # its like javascript, everything is allowed unless you prevent it.

topdir=$(git rev-parse --show-toplevel)

cd $topdir
# setup: persist the scripts between commits
mkdir -p tmp
cp -r .metrics tmp/
git checkout master
git pull origin master

# create the log of commits
git log --format=oneline --since=2020-01-01 | tac | awk '{print $1}' > tmp/commit-list
cd tmp/.metrics

# do stuff with the commits
for commit in $(cat $topdir/tmp/commit-list)
do
  git checkout $commit
  # python script pulls from env variables, export those
  export total_count=$(find $topdir/rust -iname '*.rs' -type f -exec cat {} + | grep -c -E "(Emit|Parse|ScopeBuild)Error::NotImplemented")
  export current_commit=$commit
  python not_implemented_count.py
  python not_implemented_badge.py
done

cd $topdir
git checkout $ci_branch

# replace this file stuff with whatever it is you want to do to get it to the right place in the
# repo
mv -f tmp/.metrics/count/not-implemented.json .metrics/count/not-implemented.json
mv -f tmp/.metrics/badges/not-implemented.json .metrics/badges/not-implemented.json

# Cleanup: Kill the tmp dir
rm -r tmp

git add .
git commit -m"Add NotImplemented"