esc-reporting/esc-analyze.py |   48 +++++++++++++++++++++++++++++++++++++++++++
 esc-reporting/esc-report.py  |   42 +++++++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)

New commits:
commit c93c1a0858f7b923882f349389d9770519094e8d
Author:     Xisco Fauli <[email protected]>
AuthorDate: Wed Oct 20 18:30:59 2021 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Wed Oct 20 18:33:35 2021 +0200

    esc-report: create documentation report
    
    Change-Id: Idc8d9535949a5e8dbb46e0d0cb1268bc0c403fd8

diff --git a/esc-reporting/esc-report.py b/esc-reporting/esc-report.py
index d9711d7..df9b80a 100755
--- a/esc-reporting/esc-report.py
+++ b/esc-reporting/esc-report.py
@@ -231,6 +231,11 @@ def report_esc_prototype():
     fp.close()
     escPrototype = escPrototype.replace('$<ESC_UX_UPDATE>', data)
 
+    fp = open('/tmp/esc_documentation_report.txt', encoding='utf-8')
+    data = fp.read()
+    fp.close()
+    escPrototype = escPrototype.replace('$<ESC_DOCUMENTATION_UPDATE>', data)
+
     fp = open('/tmp/esc_mentoring_report.txt', encoding='utf-8')
     data = fp.read()
     fp.close()
@@ -511,7 +516,37 @@ def report_bug_metrics():
     return {'title': data, 'mail': '[email protected]',
             'attach': {'name': fileName, 'path': filePath, 'extension': 
'ods'}, 'file' : fileBody}
 
+def report_documentation():
+    global statList, cfg
+    tmpClist = sorted(statList['people'], key=lambda k: 
(statList['people'][k]['documentation']['1month']['history']+statList['people'][k]['documentation']['1month']['commented']),
 reverse=True)
+    top10list = []
+    for i in tmpClist:
+      if i != '[email protected]' and i != 
'[email protected]':
+        xYear = statList['people'][i]['documentation']['1year']['history'] + 
statList['people'][i]['documentation']['1year']['commented']
+        xMonth = statList['people'][i]['documentation']['1month']['history'] + 
statList['people'][i]['documentation']['1month']['commented']
+        x = {'mail': i, 'name': statList['people'][i]['name'],
+             'month' : xMonth,
+             'year': xYear}
+        top10list.append(x)
+        if len(top10list) >= 10:
+          break
 
+    fp = open('/tmp/esc_documentation_report.txt', 'w', encoding='utf-8')
+    print("    + Bugzilla Documentation statistics\n"
+          "        {} bugs open\n"
+          "    + Updates:".format(
+          util_build_escNumber('documentation', 'open')), file=fp)
+
+    xRow = [{'db': 'documentation', 'tag': 'created',     'text': 'created'},
+            {'db': 'documentation', 'tag': 'commented', 'text': 'commented'},
+            {'db': 'documentation', 'tag': 'resolved',  'text': 'resolved'}]
+    print(util_build_matrix('BZ changes', xRow, 'contributor'), end='', 
file=fp)
+    print("    + top 10 contributors:", file=fp)
+    for i in range(0, 10):
+      print('          {} made {} changes in 1 month, and {} changes in 1 
year'.format(
+            top10list[i]['name'], top10list[i]['month'], 
top10list[i]['year']), file=fp)
+    fp.close()
+    return None
 
 def report_ui():
     global statList, cfg
@@ -814,6 +849,13 @@ def runReport():
     except Exception as e:
       common.util_errorMail(cfg, 'esc-report', 'ERROR: report_mentoring failed 
with ' + str(e))
       pass
+    try:
+      x = report_documentation()
+      if not x is None:
+        xMail.append(x)
+    except Exception as e:
+      common.util_errorMail(cfg, 'esc-report', 'ERROR: report_documentation 
failed with ' + str(e))
+      pass
     try:
       x = report_ui()
       if not x is None:
commit 91c418a8f52831c9d5af9f96e0e9cf3886b3940f
Author:     Xisco Fauli <[email protected]>
AuthorDate: Wed Oct 20 18:29:33 2021 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Wed Oct 20 18:29:33 2021 +0200

    esc-analyze: Add documentation stats
    
    Change-Id: If494e8268864aec30c9daa962e1ed498ae979644

diff --git a/esc-reporting/esc-analyze.py b/esc-reporting/esc-analyze.py
index 78b43a7..074e2d5 100755
--- a/esc-reporting/esc-analyze.py
+++ b/esc-reporting/esc-analyze.py
@@ -163,6 +163,11 @@ def util_create_person_gerrit(person, email):
                          '1month': {'commented': 0, 'history': 0},
                          '1week':  {'commented': 0, 'history': 0},
                          'total':  0},
+             'documentation':      {'1year':  {'commented': 0, 'history': 0},
+                         '3month': {'commented': 0, 'history': 0},
+                         '1month': {'commented': 0, 'history': 0},
+                         '1week':  {'commented': 0, 'history': 0},
+                         'total':  0},
              'qa': {'1year':  {'owner': 0, 'reviewer': 0, 'regression': 0, 
'bibisected': 0,
                                'bisected': 0, 'backtrace': 0, 'fixed': 0, 
'total': 0},
                     '3month': {'owner': 0, 'reviewer': 0, 'regression': 0, 
'bibisected': 0,
@@ -212,6 +217,8 @@ def util_create_statList():
                                 'contributor': {'owner':        {'1year': {}, 
'3month': {}, '1month': {}, '1week': {}},
                                                 'reviewMerged': {'1year': {}, 
'3month': {}, '1month': {}, '1week': {}}},
                                 'ui':          {'commented':    {'1year': {}, 
'3month': {}, '1month': {}, '1week': {}},
+                                                'history':      {'1year': {}, 
'3month': {}, '1month': {}, '1week': {}}},
+                                'documentation': {'commented':    {'1year': 
{}, '3month': {}, '1month': {}, '1week': {}},
                                                 'history':      {'1year': {}, 
'3month': {}, '1month': {}, '1week': {}}}},
                      'ui': {'contributor': {'1year':  {'added': 0, 'removed': 
0, 'commented': 0, 'resolved': 0},
                                             '3month': {'added': 0, 'removed': 
0, 'commented': 0, 'resolved': 0},
@@ -220,6 +227,12 @@ def util_create_statList():
                                             'total': 0},
                             'needsUXEval' : 0,
                             'topicUI': 0},
+                     'documentation': {'contributor': {'1year':  {'created': 
0, 'commented': 0, 'resolved': 0},
+                                            '3month': {'created': 0, 
'commented': 0, 'resolved': 0},
+                                            '1month': {'created': 0, 
'commented': 0, 'resolved': 0},
+                                            '1week':  {'created': 0, 
'commented': 0, 'resolved': 0},
+                                            'total': 0},
+                            'open': 0},
                      'qa': {'unconfirmed': {'count': 0, 'documentation': 0, 
'enhancement': 0, 'needsUXEval': 0,
                          'haveBacktrace': 0, 'needsDevAdvice': 0, 'android': 
0, 'ios': 0, 'online': 0}},
                      'easyhacks' : {'needsDevEval': 0,  'needsUXEval': 0, 
'cleanup_comments': 0,
@@ -447,7 +460,36 @@ def analyze_ui():
           if 'needsUXEval' in entry['removed']:
             util_build_period_stat(xDate, email, 'ui', dataTarget='removed')
 
+def analyze_documentation():
+    global cfg, statList, bugzillaData
 
+    print("documentation: analyze bugzilla", flush=True)
+
+    for key, row in bugzillaData['bugs'].items():
+      xDate = datetime.datetime.strptime(row['last_change_time'], 
"%Y-%m-%dT%H:%M:%SZ")
+      if xDate > cfg['cutDate']:
+        continue
+
+      if row['component'] != 'Documentation':
+        continue
+
+      for change in row['comments']:
+        email = util_check_mail('*UNKNOWN*', change['creator'])
+        xDate = datetime.datetime.strptime(change['creation_time'], 
"%Y-%m-%dT%H:%M:%SZ")
+        util_build_period_stat(xDate, email, 'documentation', 
dataTarget='commented', peopleTarget='commented')
+
+      for change in row['history']:
+        email = util_check_mail('*UNKNOWN*', change['who'])
+        xDate = datetime.datetime.strptime(change['when'], 
"%Y-%m-%dT%H:%M:%SZ")
+        for entry in change['changes']:
+          util_build_period_stat(xDate, email, 'documentation', 
peopleTarget='history')
+
+      util_build_period_stat(xDate, None, 'documentation', 
dataTarget='created')
+
+      if row['status'] == 'RESOLVED' or row['status'] == 'CLOSED' or 
row['status'] == 'VERIFIED':
+        util_build_period_stat(xDate, None, 'documentation', 
dataTarget='resolved')
+      else:
+        statList['data']['documentation']['open'] += 1
 
 def analyze_qa():
     global cfg, statList, bugzillaData
@@ -1013,6 +1055,11 @@ def runAnalyze():
     except Exception as e:
       common.util_errorMail(cfg, 'esc-analyze', 'ERROR: analyze_ui failed with 
' + str(e))
       pass
+    try:
+      analyze_documentation()
+    except Exception as e:
+      common.util_errorMail(cfg, 'esc-analyze', 'ERROR: analyze_documentation 
failed with ' + str(e))
+      pass
     try:
       analyze_qa()
     except Exception as e:
@@ -1071,6 +1118,7 @@ def runUpgrade(args):
       statList['aliases'] = csvList['aliases']
       analyze_mentoring()
       analyze_ui()
+      analyze_documentation()
       analyze_qa()
       analyze_esc()
       analyze_myfunc()

Reply via email to