Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions contributors-special.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Special cases where we consider the CLA to be signed,
# although the username on the commit doesn't match contributors.json.

philip_durbin # "pdurbin" is in contributors.json.
raman_prasad # "raprasad" is in contributors.json.
ethan24 # "ecowan" is in contributors.json.
damienbfs # "TedTed" is in contributors.json.

# User w/o CLA: lines
#
# abigail-gentle: 380
# No response from Abigail Gentle.
# matchaginseng: 156
# No email for Vicki Xu.
# orespo: 140
# No email for Oren ___.
# chle: 80
# CLA signed by university representative: Peter Sestoft, Martin Zachariasen, or Jens Christian Godskesen depending on the date.
# Review old emails?
# abuahchu: 24
# No response from Chike Abuah.
Comment on lines +20 to +21

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# abuahchu: 24
# No response from Chike Abuah.
# abuahchu: 24
# No response from Chike Abuah.
# 2 PRs:
# https://github.com/opendp/opendp/pull/1406
# Fix shell syntax in notebooks; Lines deleted when we added the examples module.
# https://github.com/opendp/opendp/pull/1362
# Just a rename from TotalOrd to ProductOrd; Still in place.

# roykoand: 9
# No email for Andrii Roiko.
Comment on lines +22 to +23

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# roykoand: 9
# No email for Andrii Roiko.
# roykoand: 9
# No email for Andrii Roiko.
# 1 PR:
# https://github.com/opendp/opendp/pull/2161
# 9 misspellings corrected.

# fefealzueta: 5
# No email for ___.
Comment on lines +24 to +25

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Email is fefealzueta@gmail.com

Suggested change
# fefealzueta: 5
# No email for ___.
# fefealzueta: 5
# Fernando Alzueta
# 1 PR:
# https://github.com/opendp/opendp/pull/2138
# Missing quotes on pip install.

75 changes: 75 additions & 0 deletions tools/coverage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
from pathlib import Path
from subprocess import check_output
from os import chdir
import re
from collections import Counter
from json import loads


def get_blame(blame_path):
chdir("/tmp")
path = Path("opendp")
if not path.exists():
check_output("git clone https://github.com/opendp/opendp.git".split(" "))
chdir("opendp")
blames = []
for root, dirs, files in Path(".").walk():
for file in files:
file_path = root/file
if str(file_path).startswith('.git/'):
# Fresh checkout, so shouldn't have any generated files to ignore.
continue
print(file_path)
if file_path.is_dir():
continue
try:
blame = check_output(f"git blame --show-email {file_path}".split(" "), text=True)
except UnicodeDecodeError:
continue
blames += [f"{file_path}: {line}" for line in blame.splitlines()]
chdir("..")
blame_path.write_text("\n".join(blames))


def get_counts():
chdir("/tmp")
blame_path = Path("opendp.blame")
if not blame_path.exists():
get_blame(blame_path)
blame = blame_path.read_text().splitlines()
counts = Counter()
for line in blame:
m = re.match(r'^([^:]+): [0-9a-f^]{9}(?: [^(]+)? \(<(?:\d+\+)?([^@]+)', line)
if m:
file = m.group(1)
user = m.group(2).lower()
counts[user] += 1
else:
raise Exception(f'No match: {line}')
return counts


def get_contrib():
contributors_json = (Path(__file__).parent.parent / 'contributors.json').read_text()
contributors = [c.lower() for c in loads(contributors_json)]
return contributors


def get_special():
special_txt = (Path(__file__).parent.parent / 'contributors-special.txt').read_text()
contributors = [uncomment for line in special_txt.splitlines() if (uncomment := line.split('#')[0].strip())]
return contributors

def main():
counts = get_counts()
contributors = get_contrib()
specials = get_special()
for c in contributors:
del counts[c]
for s in specials:
del counts[s]
for (k, v) in counts.most_common():
print(f"{k}: {v}")

if __name__ == '__main__':
main()