Created
October 20, 2022 14:20
-
-
Save fujimura/532bd90fd2b66d139fea0396e0310024 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import subprocess | |
import datetime | |
raw = ( | |
subprocess.Popen( | |
'git log --pretty=" %at, %h" --reverse --after "2020/01/01" .rubocop_todo.yml', | |
shell=True, | |
stdout=subprocess.PIPE, | |
) | |
.stdout.read() | |
.decode() | |
) | |
x = [] | |
y = [] | |
lines = raw.splitlines() | |
lines.sort() | |
for l in lines: | |
unixtime, sha = l.split(",") | |
date = datetime.datetime.fromtimestamp(int(unixtime)) | |
length = ( | |
subprocess.Popen( | |
f"git cat-file -p {sha}:.rubocop_todo.yml | wc -l", | |
shell=True, | |
stdout=subprocess.PIPE, | |
) | |
.stdout.read() | |
.decode() | |
).strip() | |
x.append(date) | |
y.append(int(length)) | |
fig = plt.figure() | |
ax = fig.add_subplot(1, 1, 1, ylim=(0, max(y) + 100)) | |
plt.xticks(rotation=90) | |
ax.plot(x, y) | |
plt.tight_layout() | |
plt.legend() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment