Created
September 29, 2018 00:57
-
-
Save cookieguru/41063dad8c644ff038364db688a9b5d1 to your computer and use it in GitHub Desktop.
Graphing lines of code over time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /path/to/your/code | |
mkdir ../counts | |
git log --format=format:"git reset --hard %H&&cloc --skip-uniqueness --force-lang=HTML,twig --sql-project=\"%ai\" --sql=../counts/%H.sql ." --no-merges > ../runme.sh | |
bash ../runme.sh | |
mysql -u root -p stats < grep -h ../counts/* insert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM ( | |
SELECT Project as Date, Language, SUM(nBlank) AS Blank, SUM(nComment) AS Comment, SUM(nCode) AS Code, SUM(nBlank) + SUM(nComment) + SUM(nCode) AS Total | |
FROM t | |
GROUP BY Project, Language | |
UNION | |
SELECT Project as Date, 'Total' AS Language, SUM(nBlank) AS Blank, SUM(nComment) AS Comment, SUM(nCode) AS Code, SUM(nBlank) + SUM(nComment) + SUM(nCode) AS Total | |
FROM t | |
GROUP BY Project | |
) AS x | |
ORDER BY Date, Language = 'Total', Language |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment