count-lines-of-code-per-committer.sh 1.0 KB

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. # At 2024, GitHub removed feature of counting lines of code from
  3. # https://github.com/wekan/wekan/graphs/contributors
  4. # "Contributions to main, line counts have been omitted because commit count exceeds 10,000."
  5. #
  6. # This code counts lines of code per email address:
  7. # https://github.com/orgs/community/discussions/89886#discussioncomment-8650093
  8. if [ $# -ne 1 ]
  9. then
  10. echo "Syntax to count lines of code per committer, by email address:"
  11. echo " ./releases/count-lines-of-code-per-committer.sh x@xet7.org"
  12. echo "Example result at 2024-03-08:"
  13. echo " added lines: 4594802, removed lines: 4416066, total lines: 178736, added:deleted ratio:1.04047"
  14. exit 1
  15. fi
  16. git log --author=$1 --pretty=tformat: --numstat | awk '{ adds += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s, added:deleted ratio:%s\n", adds, subs, loc, adds/subs }' -
  17. # Related: Most active GitHub users in Finland:
  18. # https://committers.top/finland.html
  19. # at 2024-03-08, xet7 was 3rd.