-
-
Save jdmonty/55fd83f5abbf58d0a258c317b26bb3a6 to your computer and use it in GitHub Desktop.
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
[$github, $bitbucket] | |
| (flatten) as $all_projects | |
| ([$all_projects[] | select(.stats.languages != null).stats.languages | to_entries] | flatten) as $langstats | |
| ( | |
[ | |
$all_projects[] | |
| select(.stats.languages != null).stats.languages | |
| keys | |
] | |
| flatten | |
| [ | |
group_by(.)[][0] as $language | |
| { | |
($language): { | |
in_projects: ([$langstats[] | select(.key == $language)] | length), | |
lines: ([$langstats[] | select(.key == $language).value.lines ] | add), | |
code: ([$langstats[] | select(.key == $language).value.code ] | add), | |
comment: ([$langstats[] | select(.key == $language).value.comment] | add), | |
files: ([$langstats[] | select(.key == $language).value.files ] | add) | |
} | |
} | |
] | |
| add | |
| to_entries | |
| sort_by(.value) | |
| reverse | |
| from_entries | |
) as $language_usage | |
| ($language_usage | [to_entries[].value]) as $language_usage_values | |
| { | |
date: (now), | |
stats: { | |
projects: ($all_projects | length), | |
scm_ratios: { | |
bitbucket: (($bitbucket | length) / ($all_projects | length)), | |
github: (($github | length) / ($all_projects | length)) | |
}, | |
code: { | |
lines: ([$language_usage_values[].lines ] | add), | |
code: ([$language_usage_values[].code ] | add), | |
comment: ([$language_usage_values[].comment] | add), | |
files: ([$language_usage_values[].files ] | add) | |
}, | |
language_usage: $language_usage | |
}, | |
projects: $all_projects | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment