[Libreoffice-commits] dev-tools.git: 4 commits - qa/createWeeklyReport.py

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Aug 31 01:01:29 UTC 2018


 qa/createWeeklyReport.py |  160 ++++++++++++++++++++++++++++++-----------------
 1 file changed, 104 insertions(+), 56 deletions(-)

New commits:
commit ab8875998497909f4e52e8404a380671eac527cf
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Aug 31 02:47:44 2018 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Aug 31 02:47:44 2018 +0200

    QA: Also show which was the previous status

diff --git a/qa/createWeeklyReport.py b/qa/createWeeklyReport.py
index 9738ca4..f09dc19 100755
--- a/qa/createWeeklyReport.py
+++ b/qa/createWeeklyReport.py
@@ -19,8 +19,8 @@ def util_create_statList_weeklyReport():
         'unconfirmed': [],
         'newUsers': {},
         'comments_count': {},
-        'status_changed': {s: {'id':[], 'author': [] } for s in common.statutes_list},
-        'keyword_added': {k: {'id':[], 'author': [], 'status': {s:0 for s in common.statutes_list}} for k in common.keywords_list},
+        'status_changed': {},
+        'keyword_added': {k: {'id':[], 'author': []} for k in common.keywords_list},
         'keyword_removed': {k: {'id':[], 'author': []} for k in common.keywords_list},
         'whiteboard_added': {},
         'whiteboard_removed': {},
@@ -53,10 +53,6 @@ def analyze_bugzilla_weeklyReport(statList, bugzillaData, cfg):
                 statNewDate = creationDate
 
             rowStatus = row['status']
-            rowResolution = row['resolution']
-
-            if rowStatus == 'VERIFIED' or rowStatus == 'RESOLVED':
-                rowStatus += "_" + rowResolution
 
             if rowStatus == 'UNCONFIRMED':
                 statList['unconfirmed'].append(rowId)
@@ -80,8 +76,11 @@ def analyze_bugzilla_weeklyReport(statList, bugzillaData, cfg):
                 actionDate = datetime.datetime.strptime(action['when'], "%Y-%m-%dT%H:%M:%SZ")
                 common.util_check_bugzilla_mail(statList, actionMail, '', actionDate, rowId)
 
-                # Use this variable in case the status is set before the resolution
+                # Use these variables in case the status is set before the resolution or viceversa
                 newStatus = None
+                newResolution = None
+                oldStatus = None
+                oldResolution = None
                 for change in action['changes']:
                     if change['field_name'] == 'blocks':
                         if change['added']:
@@ -108,28 +107,57 @@ def analyze_bugzilla_weeklyReport(statList, bugzillaData, cfg):
                         addedStatus = change['added']
                         removedStatus = change['removed']
 
+                        if removedStatus == 'RESOLVED' or removedStatus == 'VERIFIED':
+                            if oldResolution:
+                                removedStatus = removedStatus + "_" + removedResolution
+                                oldResolution = None
+                            else:
+                                oldStatus = removedStatus
+
                         if  addedStatus == 'RESOLVED' or addedStatus == 'VERIFIED':
-                            if rowResolution:
-                                addedStatus = addedStatus + "_" + rowResolution
+                            if newResolution:
+                                addedStatus = addedStatus + "_" + newResolution
                                 if actionDate >= cfg['reportPeriod']:
-                                    statList['status_changed'][addedStatus]['id'].append(rowId)
-                                    statList['status_changed'][addedStatus]['author'].append(actionMail)
+                                    keyValue = removedStatus + '-' + addedStatus
+                                    if keyValue not in statList['status_changed']:
+                                        statList['status_changed'][keyValue] = {'id':[], 'author':[]}
+                                    statList['status_changed'][keyValue]['id'].append(rowId)
+                                    statList['status_changed'][keyValue]['author'].append(actionMail)
+
+                                newResolution = None
                             else:
                                 newStatus = addedStatus
                         else:
                             if actionDate >= cfg['reportPeriod']:
-                                statList['status_changed'][addedStatus]['id'].append(rowId)
-                                statList['status_changed'][addedStatus]['author'].append(actionMail)
+                                keyValue = removedStatus + '-' + addedStatus
+                                if keyValue not in statList['status_changed']:
+                                    statList['status_changed'][keyValue] = {'id':[], 'author':[]}
+                                statList['status_changed'][keyValue]['id'].append(rowId)
+                                statList['status_changed'][keyValue]['author'].append(actionMail)
 
                     elif change['field_name'] == 'resolution':
+                        addedResolution = change['added']
+                        removedResolution = change['removed']
+
+                        if oldStatus:
+                            removedStatus = oldStatus + "_" + removedResolution
+                            oldStatus = None
+                        else:
+                            oldResolution = removedResolution
+
                         if newStatus:
-                            addedStatus = newStatus + "_" + change['added']
+                            addedStatus = newStatus + "_" + addedResolution
 
                             if actionDate >= cfg['reportPeriod']:
-                                statList['status_changed'][addedStatus]['id'].append(rowId)
-                                statList['status_changed'][addedStatus]['author'].append(actionMail)
+                                keyValue = removedStatus + '-' + addedStatus
+                                if keyValue not in statList['status_changed']:
+                                    statList['status_changed'][keyValue] = {'id':[], 'author':[]}
+                                statList['status_changed'][keyValue]['id'].append(rowId)
+                                statList['status_changed'][keyValue]['author'].append(actionMail)
 
                             newStatus = None
+                        else:
+                            newResolution = addedResolution
 
                     elif change['field_name'] == 'priority':
                         newPriority = change['added']
@@ -152,7 +180,6 @@ def analyze_bugzilla_weeklyReport(statList, bugzillaData, cfg):
                                 if actionDate >= cfg['reportPeriod'] and keyword in rowKeywords:
                                     statList['keyword_added'][keyword]['id'].append(rowId)
                                     statList['keyword_added'][keyword]['author'].append(actionMail)
-                                    statList['keyword_added'][keyword]['status'][rowStatus] += 1
 
                         keywordsRemoved = change['removed'].split(", ")
                         for keyword in keywordsRemoved:
@@ -247,6 +274,9 @@ def util_print_QA_line_weekly(fp, statList, dValue, action, isMetabug=False):
                 if action == 'removed':
                     aux3 = 'from'
                 print(('  * \'{}\' has been {} {} {} {}.').format(key, action, aux3, nBugs, aux2), file=fp)
+            elif action == 'changedStatus':
+                statuses = key.replace('_', ' ').split('-')
+                print(('  * {} {} been changed from \'{}\' to \'{}\'.').format(nBugs, aux1, statuses[0], statuses[1]), file=fp)
             else:
                 print(('  * {} {} been changed to \'{}\'.').format(nBugs, aux1, key.replace('_', ' ')), file=fp)
 
@@ -331,7 +361,7 @@ def create_weekly_Report(statList) :
 
     if statList['status_changed']:
         print("== STATUSES CHANGED ==", file=fp)
-        util_print_QA_line_weekly(fp, statList, statList['status_changed'], 'changed')
+        util_print_QA_line_weekly(fp, statList, statList['status_changed'], 'changedStatus')
 
     if statList['keyword_added']:
         print("== KEYWORDS ADDED ==", file=fp)
commit 6a4a89a15a23c49d40f6b6caedcfe69af970e7d0
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Aug 31 01:27:28 2018 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Aug 31 01:27:28 2018 +0200

    QA: show all changes in the weekly report, not just the last one
    
    Remove some unused code as well

diff --git a/qa/createWeeklyReport.py b/qa/createWeeklyReport.py
index 5c834b2..9738ca4 100755
--- a/qa/createWeeklyReport.py
+++ b/qa/createWeeklyReport.py
@@ -108,20 +108,16 @@ def analyze_bugzilla_weeklyReport(statList, bugzillaData, cfg):
                         addedStatus = change['added']
                         removedStatus = change['removed']
 
-                        if rowStatus == 'ASSIGNED' and addedStatus == 'ASSIGNED':
-                            lastAssignedEmail = actionMail
-
                         if  addedStatus == 'RESOLVED' or addedStatus == 'VERIFIED':
-                            if(rowResolution):
+                            if rowResolution:
                                 addedStatus = addedStatus + "_" + rowResolution
-                                if actionDate >= cfg['reportPeriod'] and rowStatus == addedStatus:
+                                if actionDate >= cfg['reportPeriod']:
                                     statList['status_changed'][addedStatus]['id'].append(rowId)
                                     statList['status_changed'][addedStatus]['author'].append(actionMail)
                             else:
                                 newStatus = addedStatus
                         else:
-
-                            if actionDate >= cfg['reportPeriod'] and rowStatus == addedStatus:
+                            if actionDate >= cfg['reportPeriod']:
                                 statList['status_changed'][addedStatus]['id'].append(rowId)
                                 statList['status_changed'][addedStatus]['author'].append(actionMail)
 
@@ -129,7 +125,7 @@ def analyze_bugzilla_weeklyReport(statList, bugzillaData, cfg):
                         if newStatus:
                             addedStatus = newStatus + "_" + change['added']
 
-                            if actionDate >= cfg['reportPeriod'] and rowStatus == addedStatus:
+                            if actionDate >= cfg['reportPeriod']:
                                 statList['status_changed'][addedStatus]['id'].append(rowId)
                                 statList['status_changed'][addedStatus]['author'].append(actionMail)
 
@@ -195,21 +191,6 @@ def analyze_bugzilla_weeklyReport(statList, bugzillaData, cfg):
                             statList['system_changed'][newSystem]['id'].append(rowId)
                             statList['system_changed'][newSystem]['author'].append(actionMail)
 
-                    elif change['field_name'] == 'assigned_to':
-                        if actionDate >= cfg['reportPeriod']:
-                            removedAssignee = change['removed']
-                            addedAssignee = change['added']
-                            if  removedAssignee == "libreoffice-bugs at lists.freedesktop.org" and \
-                                    row['assigned_to'] != 'libreoffice-bugs at lists.freedesktop.org' and \
-                                    ( rowStatus == 'NEW' or rowStatus == 'UNCONFIRMED'):
-                                addAssigned = True
-                                addAssignedMail = actionMail
-                            if addedAssignee == "libreoffice-bugs at lists.freedesktop.org" and \
-                                    row['assigned_to'] == 'libreoffice-bugs at lists.freedesktop.org' and \
-                                    rowStatus == 'ASSIGNED':
-                                removeAssigned = True
-                                removeAssignedMail = actionMail
-
             commentMail = None
             comments = row['comments'][1:]
             for idx, comment in enumerate(comments):
commit c2005e008bbdf4c904b641897aec12be1dc0ee53
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Aug 30 17:46:15 2018 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Aug 30 17:46:15 2018 +0200

    QA: Fix format of done by sections

diff --git a/qa/createWeeklyReport.py b/qa/createWeeklyReport.py
index 5bfac81..5c834b2 100755
--- a/qa/createWeeklyReport.py
+++ b/qa/createWeeklyReport.py
@@ -276,15 +276,23 @@ def util_print_QA_line_weekly(fp, statList, dValue, action, isMetabug=False):
             d_view = [(v, k) for k, v in my_dict.items()]
 
             d_view.sort(reverse=True)
-            usersString = '\t\t+ Done by: '
+            print('\t\t+ Done by:', file=fp)
 
+            text = "          "
             for i1,i2 in d_view:
                 try:
-                    usersString += statList['people'][i2]['name'] + ' ( ' + str(i1) + ' ), '
+                    personString = statList['people'][i2]['name'] + ' (' + str(i1) + ')'
+                    # Reduce lines to 72 characters, for some reason the emails are cut otherwise
+                    if len( text + " " + personString ) < 72:
+                        text += personString + ", "
+                    else:
+                        print(text[:-2], file=fp)
+                        text = "          "
                 except:
                     continue
+            if text is not "          ":
+                print(text[:-2], file=fp)
 
-            print(usersString[:-2], file=fp)
             print(file=fp)
 
 def create_weekly_Report(statList) :
@@ -316,7 +324,7 @@ def create_weekly_Report(statList) :
         try:
             if it >= 15:
                 break
-            print('\t\t+ ' + statList['people'][i2]['name'] + ' ( ' + str(i1) + ' )', file=fp)
+            print('\t\t+ ' + statList['people'][i2]['name'] + ' (' + str(i1) + ')', file=fp)
             it += 1
         except:
             continue
commit 24b1ab020b153cd799e3897afeb5b6fbcf61d86e
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Aug 30 15:18:32 2018 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Aug 30 15:29:55 2018 +0200

    QA: Add top 15 reporters to the weekly report

diff --git a/qa/createWeeklyReport.py b/qa/createWeeklyReport.py
index cfd6965..5bfac81 100755
--- a/qa/createWeeklyReport.py
+++ b/qa/createWeeklyReport.py
@@ -14,7 +14,7 @@ reportPeriodDays = 7
 
 def util_create_statList_weeklyReport():
     return {
-        'created': [],
+        'created': {'id': [], 'author': []},
         'still_unconfirmed': [],
         'unconfirmed': [],
         'newUsers': {},
@@ -61,19 +61,20 @@ def analyze_bugzilla_weeklyReport(statList, bugzillaData, cfg):
             if rowStatus == 'UNCONFIRMED':
                 statList['unconfirmed'].append(rowId)
 
+            creatorMail = row['creator']
+
+            common.util_check_bugzilla_mail(statList, creatorMail, row['creator_detail']['real_name'], creationDate, rowId)
+
             if creationDate >= cfg['reportPeriod']:
-                statList['created'].append(rowId)
+                statList['created']['id'].append(rowId)
+                statList['created']['author'].append(creatorMail)
                 if rowStatus == 'UNCONFIRMED':
                     statList['still_unconfirmed'].append(rowId)
 
             rowKeywords = row['keywords']
 
-            creatorMail = row['creator']
-
             crashSignature = row['cf_crashreport']
 
-            common.util_check_bugzilla_mail(statList, creatorMail, row['creator_detail']['real_name'], creationDate, rowId)
-
             for action in row['history']:
                 actionMail = action['who']
                 actionDate = datetime.datetime.strptime(action['when'], "%Y-%m-%dT%H:%M:%SZ")
@@ -295,20 +296,48 @@ def create_weekly_Report(statList) :
     print('What have happened in QA in the last {} days?'.format(reportPeriodDays), file=fp)
     print(file=fp)
 
-    print('  * {} bugs have been created, of which, {} are still unconfirmed ( Total Unconfirmed bugs: {} )'.format(\
-            len(statList['created']),
-            len(statList['still_unconfirmed']),
-            len(statList['unconfirmed'])), file=fp)
+    #Count the number of reps
+    my_dict = {i: statList['created']['author'].count(i) for i in statList['created']['author']}
 
-    common.util_create_short_url(fp, statList['created'], 'Created bugs')
-    common.util_create_short_url(fp, statList['still_unconfirmed'], 'Still unconfirmed bugs')
+    d_view = [(v, k) for k, v in my_dict.items()]
 
+    print('  * {} bugs have been reported by {} people.'.format(\
+            len(statList['created']['id']),
+            len(d_view)), file=fp)
+
+    common.util_create_short_url(fp, statList['created']['id'])
     print(file=fp)
-    print('  * {} comments have been written by {} users.'.format(
+
+    d_view.sort(reverse=True)
+    print('  * Top 15 reporters:', file=fp)
+
+    it = 0
+    for i1,i2 in d_view:
+        try:
+            if it >= 15:
+                break
+            print('\t\t+ ' + statList['people'][i2]['name'] + ' ( ' + str(i1) + ' )', file=fp)
+            it += 1
+        except:
+            continue
+
+    print(file=fp)
+
+    print("  * {} bugs reported haven't been triaged yet.".format(\
+            len(statList['still_unconfirmed'])), file=fp)
+
+    common.util_create_short_url(fp, statList['still_unconfirmed'])
+    print(file=fp)
+
+    print("  * Total number of unconfirmed bugs: {}".format(\
+            len(statList['unconfirmed'])), file=fp)
+    print(file=fp)
+
+    print('  * {} comments have been written by {} people.'.format(
         sum(statList['comments_count'].values()), len(statList['comments_count'])), file=fp)
     print(file=fp)
 
-    print('  * {} new users have signed up to Bugzilla.'.format(len(statList['newUsers'])), file=fp)
+    print('  * {} new people have signed up to Bugzilla.'.format(len(statList['newUsers'])), file=fp)
     print(file=fp)
 
     if statList['status_changed']:


More information about the Libreoffice-commits mailing list