Skip to content
Merged
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
5 changes: 5 additions & 0 deletions oss-contributor-stats/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To get the percentage of non-founder contributions:

0. Run `cd oss-contributor-stats`
1. Run `./get_stats.sh > stats.txt`. In this script is defined how many days to look back.
2. Run `python process_stats.py`. In this script is defined who the founders are.
11 changes: 11 additions & 0 deletions oss-contributor-stats/get_stats.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Get the list of authors and their commit counts for the last 60 days
git log --since="200 days ago" --pretty=format:"%an" | sort | uniq -c | sort -rn

# Get the total number of commits in the last 60 days
total=$(git log --since="200 days ago" --oneline | wc -l)

echo "Total commits: $total"

# to run this file: ./get_stats.sh > stats.txt
32 changes: 32 additions & 0 deletions oss-contributor-stats/process_stats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
def process_stats(filename, founders):
with open(filename, 'r') as f:
lines = f.readlines()

total_commits = int(lines[-1].split(":")[1].strip())
founder_commits = 0

for line in lines[:-1]:
count, author = line.strip().split(None, 1)
if author in founders:
founder_commits += int(count)

non_founder_commits = total_commits - founder_commits
return total_commits, non_founder_commits

def calculate_percentage(founders):
total_commits = 0
non_founder_commits = 0

stats_file = './stats.txt'
repo_total, repo_non_founder = process_stats(stats_file, founders)
total_commits += repo_total
non_founder_commits += repo_non_founder

percentage = (non_founder_commits / total_commits) * 100 if total_commits > 0 else 0
return round(percentage, 2)

# List of founders
founders = ['Duke Pan', 'Nathan A']

percentage = calculate_percentage(founders)
print(f"Percentage of non-founder contributions in the last 200 days: {percentage}%")
7 changes: 7 additions & 0 deletions oss-contributor-stats/stats.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
29 Duke Pan
2 Wigya
2 Malo
1 akash3444
1 Nikita Teslyuk
1 Max
Total commits: 36