Skip to content

Instantly share code, notes, and snippets.

@patrickdevivo

patrickdevivo/README.md

Last active Jul 7, 2020
Embed
What would you like to do?

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