Skip to content

Instantly share code, notes, and snippets.

@patrickdevivo
Last active July 7, 2020 02:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickdevivo/5a03adfaff135a5bd8e7131b8cde1d78 to your computer and use it in GitHub Desktop.
Save patrickdevivo/5a03adfaff135a5bd8e7131b8cde1d78 to your computer and use it in GitHub Desktop.

Using gitqlite, query for percentage of commit count by author (in this case in facebook/react). Limit to top 25, include a "chart"

WITH total_commits(total) AS (
SELECT count(*) AS total FROM commits
)
SELECT
author_name,
round(count(*)*100.0 / (SELECT total FROM total_commits), 2) AS percentage,
printf('%.' || (CAST (round(count(*)*100.0 / (SELECT total FROM total_commits)) AS INT) + 1) || 'c', '*') AS commits
FROM commits GROUP BY author_name
ORDER BY percentage DESC
LIMIT 25
cat query.sql | gitqlite --repo https://github.com/facebook/react
+---------------------+------------+----------------+
| AUTHOR NAME | PERCENTAGE | COMMITS |
+---------------------+------------+----------------+
| Paul O’Shannessy | 13.04 | ************** |
| Dan Abramov | 10.7 | ************ |
| Brian Vaughn | 10.41 | *********** |
| Ben Alpert | 9.06 | ********** |
| Andrew Clark | 5.72 | ******* |
| Sebastian Markbåge | 3.51 | ***** |
| Jim | 3.25 | **** |
| Dominic Gannaway | 3.06 | **** |
| Sebastian Markbage | 2.78 | **** |
| Cheng Lou | 1.66 | *** |
| Pete Hunt | 1.42 | ** |
| Christopher Chedeau | 1.24 | ** |
| petehunt | 1.06 | ** |
| Ben Newman | 1.05 | ** |
| Thomas Aylott | 0.86 | ** |
| CommitSyncScript | 0.73 | ** |
| Nicolas Gallagher | 0.69 | ** |
| Nathan Hunzaker | 0.64 | ** |
| Brandon Dail | 0.58 | ** |
| Andreas Svensson | 0.53 | ** |
| Flarnie Marchan | 0.51 | ** |
| Toru Kobayashi | 0.47 | * |
| Sophie Alpert | 0.45 | * |
| Dan | 0.41 | * |
| Timothy Yung | 0.37 | * |
+---------------------+------------+----------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment