gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.5KB

  1. #!/usr/bin/python
  2. #
  3. # Runme From the repo toplevel directory
  4. #
  5. from __future__ import print_function
  6. import subprocess
  7. import glob
  8. import re
  9. import pprint
  10. cla_glob = "doc/cla/*/*.md"
  11. cla = ''.join(open(f).read() for f in glob.glob(cla_glob))
  12. cla = cla.lower()
  13. def cla_signed(email):
  14. if re.match('.*(odoo|openerp|tinyerp).com$',email):
  15. return True
  16. if cla.find(email) != -1:
  17. return True
  18. return False
  19. def blamestat(ext='py'):
  20. r = {}
  21. ok = 0
  22. okl = []
  23. ko = 0
  24. kol = []
  25. p = subprocess.Popen("git ls-tree -r -z --name-only HEAD | grep -z '.%s$' | xargs -0 -n1 git blame --line-porcelain HEAD |grep '^author-mail ' |sort |uniq -c|sort -nr" % ext, shell=True, stdout = subprocess.PIPE)
  26. for i in p.stdout.read().split('\n'):
  27. mo = re.search(r'(\d+) author-mail <([^ @<]+@[^ @<]+)>',i)
  28. if mo:
  29. lines = int(mo.group(1))
  30. email = mo.group(2)
  31. if cla_signed(email):
  32. ok += lines
  33. okl.append(i)
  34. else:
  35. ko += lines
  36. kol.append(i)
  37. print('-'*60)
  38. print('Stats for ', ext)
  39. print('-'*60)
  40. print("\nCLA SIGNED %s/%s (%.0f%%)" % (ok, ok+ko, ok*100.0/(ok+ko)))
  41. for i in okl:
  42. print(i)
  43. print("\nCLA MISSING %s/%s (%.0f%%)\n" % (ko, ok+ko, ko*100.0/(ok+ko)))
  44. for i in kol:
  45. print(i)
  46. print()
  47. print()
  48. blamestat('md')
  49. blamestat('rst')
  50. blamestat('py')
  51. blamestat('js')
  52. blamestat('xml')
  53. blamestat('csv')
上海开阖软件有限公司 沪ICP备12045867号-1