HwangTaehyun / github-repository-contribution-stats

:fire: Dynamically generated Github Repository Contribution stats on your readmes (github-repository-contribution-stats)
https://github-contributor-stats.vercel.app
98 stars 21 forks source link

Stats are misleading #16

Closed calebdw closed 3 months ago

calebdw commented 6 months ago

First off, thanks for sharing this---I love it!

For reference, here are my stats:

image

These are supposed to be my "Contributor Stats", so I would expect these to be the stats of my personal contributions to the repos (i.e., if you've contributed more than 95% of anyone else to a particular repo, then you would have an S+ rank for that repo).

Instead, this is simply just a star count of the repos I've contributed to, which doesn't really tell me much in terms of my personal stats. For instance, I've only made one PR to tree-sitter (and a small one at that), and yet it shows up second on the list like I've contributed a bunch to it.

A stat that would be useful would be to take the percentage of my commits against the total number of commits to a repo for that year (or total if that's the config option) and rank that.

Thanks!

HwangTaehyun commented 4 months ago

@calebdw, Thank you for your attention! I want to express absolute contribution impact by using the repo's rank. What do you think about adding one more column to express personal contributions?

calebdw commented 4 months ago

@HwangTaehyun, it seems to me that the entire point of this banner is to show the contributor's stats. If a user merely contributes a typo fix to the Laravel Framework, that's likely to cause it to shoot to the top of their list with an S+ rating because it's a popular framework---despite not having any meaningful contributions.

It's not as simple as adding a second column because the entire ordering of the list would have to change.

On the other hand, you could show the user's contribution score in the first column, and the repo score in the second column:

Repo Contributor Score Repo Score
Laravel/Framework B S+

This now paints the full picture, how much a user contributes to a certain project and the popularity of that project. The ordering should also take into account both scores---for example a B contributor score in a S+ project would hold much more weight than an S+ contributor score in a C project

HwangTaehyun commented 3 months ago

@calebdw Nice Idea! I implemented the code querying the user's contribution commits to the repo and the total commits of the repo.

There is one thing to worry about. If you have any ideas for the contribution rank system, can you share them?

If the total commit of the repo is 10000 and the personal contribution commit is 1000, then the contribution portion is 1000/10000. It's 10% and some think it is low but if this repo is very popular and many people contribute this repo, this portion is relatively high.

However, it's too complicated to consider this.

Should we just simply do this?: S if it is more than 10%, A+ if it is more than 8%...

calebdw commented 3 months ago

@HwangTaehyun,

Awesome! I didn't think about the complications of calculating everyone's score with respect to all the others. But after thinking about this some more, I realized that Github already ranks user's contributions to a repo:

Screenshot_20240505_150646_Brave

All you would have to do is grab the list of contributors to a repo and see where they're ranked in the list---your normal scores could then apply (e.g., top 1% for S+, 90% for A, etc or whatever they actually are).

HwangTaehyun commented 3 months ago

@calebdw I added this feature. Check it out! However, this feature requires this github API (https://api.github.com/repos/${nameWithOwner}/contributors?page=${page}&per_page=100) and this has API query limit of 5000 for free accounts per hour. So, if this has reached to limit then it shows contributor rank to B. You should apply your vercel server for better working!

calebdw commented 3 months ago

@HwangTaehyun, this looks awesome! Thanks!

image

A couple of suggestions for improvement:

HwangTaehyun commented 3 months ago

@calebdw Your correct rank is the following stats.

image

However, sometimes the API limit is reached then all ranks seem to show B. I changed hide_contributor_rank's default value to true to prevent API limit.

You should deploy your vercel instance and use it! https://github.com/anuraghazra/github-readme-stats/issues/3092

HwangTaehyun commented 3 months ago

@calebdw Yeah, you are right. It's enough to get only 100 contributors and we can calculate the rank by only counting users who have more commit contributions than you contributed.

I also added order_by query param to order by stars or contributions. You can use order_by=contributions query param!

calebdw commented 3 months ago

@HwangTaehyun, I just updated to show the contributions and switch the column order, but they all show S+ contributions lol:

image

HwangTaehyun commented 3 months ago

@calebdw I added your contributor stats! Taehyun's GitHub Contributor stats

image