A New GitHub Rank Algorithm

November 26, 2018 · 3 minute read  

Every budding Software Engineer longs for the day that one of their GitHub projects hits 100 stars. I am proud to say that I recently hit this coveted milestone. I have this Hacker News post—which went viral for about 24 hours—to thank for that.

At the time of this writing, funky has 317 stars on GitHub. But, with that said, I imagine that only a small percentage of the users who starred the project have actually continued to use it. In fact, I’m fairly confident that the project has been overcompensated (with stars) considering how much actual use it has seen from the developer community.

Alas, I have come to a bitter conclusion regarding GitHub projects: a larger number of GitHub stars does NOT indicate a larger value added to the developer community (which IMHO should be the ultimate goal of any open source project). This realization has led me on a search for a better way.

tl;dr: GitHub stars have long been an insufficient means of determining a repository’s worth. It’s time for a new ranking system.

The Rank Algorithm

In this section, I provide an example of an algorithm that I believe provides a better metric for how useful a GitHub project is to the developer community. From this point forward we shall refer to the idea of a GitHub repository’s worth or usefulness to the developer community as the repository’s rank. The rank algorithm is based on a simple pair of assumptions:

1) GitHub stars are unreliable for determining a repository’s rank, but are a good indicator of the amount of long-term traffic that the repository has seen.

2) GitHub forks represent a form of active engagement with the repository and are thus a more valuable metric for determining repository rank.

Keeping these two assumptions in mind, I propose the following algorithm:

if ★ < 50:
    bonus=0.0
    multiplier=1.0
else if 50 <= ★ < 100:
    bonus=0.5
    multiplier=1.5
else if 100 <= ★ < 1000:
    bonus=1.0
    multiplier=3.0
else if 1000 <= ★ < 10000:
    bonus=1.5
    multiplier=3.5
else if 10000 <= ★:
    bonus=2.0
    multiplier=3.0

rank = (multiplier × min{2 × ⑂ / ★, 1}) + bonus

where ★ is the total number of stars and ⑂ is the total number of forks. This algorithm produces a numerical value between 0 and 5.

Sample Rank Calculations

To illustrate the rank algorithm above, I have used it to calculate the ranks of a few select GitHub projects.

I have used most of these projects myself and—based on each project’s available support and overall presence on the web—agree with the ranks (for the most part) output by this algorithm.

(Let me know in the comments if you disagree with any of these rankings.)

Since I cannot figure out for the life of me how to embed hyperlinks in the Chart.js bar chart above, here is a list of hyperlinks corresponding to GitHub projects referenced above 😩:

Can you do better?

The rank algorithm presented in this article is admittedly not very well thought out. It is only meant to serve as a motivational example of what could be.

Do you have a better idea? Share it in the comments!


Thanks for Reading!

Before you go, take a look at some of my more popular open source projects. These tools make my job as a programmer easier. They can do the same for you! 😄

Trending Projects

  • cookie: A template-based file generator. Like cookiecutter but works with file templates instead of project templates.
  • funky: Takes shell functions to the next level by making them easier to define, more flexible, and more interactive.
Did you enjoy the article? Follow me on Twitter so you'll be notified when I publish the next one: