Created
July 5, 2017 23:47
-
-
Save dariocravero/75ee89e10615810e9352bf2812f8dc39 to your computer and use it in GitHub Desktop.
contributions for file types per person
This file contains hidden or 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
const { execSync } = require('child_process') | |
function getStatsFor(person) { | |
const data = execSync( | |
`git log --name-only --author=${person} --pretty=format: | sort | uniq | sort -nr`, | |
{ | |
encoding: 'utf-8', | |
} | |
) | |
const files = data | |
.split('\n') | |
.filter(f => !/\.view\.js$/.test(f)) | |
.map(f => f.substr(f.indexOf('.'), f.length)) | |
.sort() | |
const count = {} | |
files.forEach(f => (count[f] = (count[f] || 0) + 1)) | |
return Object.keys(count).map(f => `${f}\t${count[f]}`).join('\n') | |
} | |
console.log('Tom', getStatsFor('Tom')) | |
console.log('Dario', getStatsFor('Darío')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment