qa/bugzillaChecker.py |   41 ++++++++++++++++++++++++++++++++++++-----
 qa/common.py          |   13 +++++++++++++
 qa/createWikiStats.py |   15 +--------------
 3 files changed, 50 insertions(+), 19 deletions(-)

New commits:
commit c623f77a3b60f1f6c8945dca57ab5274adff508c
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Nov 29 13:57:20 2019 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Nov 29 14:29:14 2019 +0100

    QA: Change priority based on number of duplicates

diff --git a/qa/bugzillaChecker.py b/qa/bugzillaChecker.py
index 9909b9a..0c7edff 100755
--- a/qa/bugzillaChecker.py
+++ b/qa/bugzillaChecker.py
@@ -48,6 +48,8 @@ versionsToCheck = ('5', '6')
 
 crashReportDomain = "https://crashreport.libreoffice.org/stats/signature/";
 
+minNumOfDupes = 5
+
 def util_create_statList_checkers():
     return {
         'people': {}
@@ -63,6 +65,7 @@ def analyze_bugzilla_checkers(statList, bugzillaData, cfg):
     print("Analyzing bugzilla chekers\n", end="", flush=True)
 
     lResults = {}
+    dupesBugs = {}
 
     for key, row in bugzillaData['bugs'].items():
         rowId = row['id']
@@ -85,6 +88,16 @@ def analyze_bugzilla_checkers(statList, bugzillaData, cfg):
 
             common.util_check_bugzilla_mail(statList, creatorMail, 
row['creator_detail']['real_name'], creationDate, rowId)
 
+            if common.isOpen(rowStatus) and rowId not in dupesBugs:
+                dupesBugs[rowId] = { 'total': 0, 'priority': row['priority'], 
'severity': row['severity'] }
+
+            rowDupeOf = common.util_check_duplicated(bugzillaData, rowId)
+            if rowDupeOf and 
common.isOpen(bugzillaData['bugs'][str(rowDupeOf)]['status']):
+                if rowDupeOf not in dupesBugs:
+                    dupesBugs[rowDupeOf] = { 'total': 0, 'priority': 
bugzillaData['bugs'][str(rowDupeOf)]['priority'],
+                            'severity': 
bugzillaData['bugs'][str(rowDupeOf)]['severity'] }
+                dupesBugs[rowDupeOf]['total'] += 1
+
             crashSignature = row['cf_crashreport']
             if crashSignature:
                 resultValue = [ rowId, creationDate, '']
@@ -386,6 +399,19 @@ def analyze_bugzilla_checkers(statList, bugzillaData, cfg):
                 value = [rowId, '', '']
                 util_add_to_result(lResults, 'empty_alias', value)
 
+    for k, v in dupesBugs.items():
+        if v['severity'] == 'enhancement':
+            if v['total'] < minNumOfDupes and (v['priority'] == 'high' or 
v['priority'] == 'highest'):
+                value = [k, '', '']
+                util_add_to_result(lResults, 
'change_enhancement_priority_to_medium', value)
+            elif v['total'] >= minNumOfDupes and (v['priority'] != 'high' and 
v['priority'] != 'highest'):
+                value = [k, '', '']
+                util_add_to_result(lResults, 
'change_enhancement_priority_to_high', value)
+        else:
+            if v['total'] >= minNumOfDupes and (v['priority'] != 'high' and 
v['priority'] != 'highest'):
+                value = [k, '', '']
+                util_add_to_result(lResults, 'change_bug_priority_to_high', 
value)
+
     fp = open(bugzillaReportPath, 'w', encoding='utf-8')
     print("Creating file " + bugzillaReportPath)
 
@@ -400,11 +426,16 @@ def analyze_bugzilla_checkers(statList, bugzillaData, 
cfg):
                         dValue[idx][1] = 
datetime.datetime.strptime(dValue[idx][1], "%Y-%m-%dT%H:%M:%SZ")
 
                 count = idx + 1
-                print("{:<3} | {:<58} | {} | {}".format(
-                    str(count), common.urlShowBug + str(dValue[idx][0]),
-                    str(dValue[idx][1].strftime("%Y-%m-%d")),
-                    str(dValue[idx][2])),
-                    file=fp)
+                if dValue[idx][1]:
+                    print("{:<3} | {:<58} | {} | {}".format(
+                        str(count), common.urlShowBug + str(dValue[idx][0]),
+                        str(dValue[idx][1].strftime("%Y-%m-%d")),
+                        str(dValue[idx][2])),
+                        file=fp)
+                else:
+                    print("{:<3} | {:<58}".format(
+                        str(count), common.urlShowBug + str(dValue[idx][0])),
+                        file=fp)
 
                 if count != len(dValue) and count % 10 == 0:
                     print('=' * 100, file=fp)
diff --git a/qa/common.py b/qa/common.py
index 51a9b47..52a5cdd 100755
--- a/qa/common.py
+++ b/qa/common.py
@@ -80,6 +80,19 @@ def util_create_person_bugzilla(email, name):
              'bugs': set()
         }
 
+def util_check_duplicated(bugzillaData, bugID, isFirst=True):
+    rowDupeOf = bugzillaData['bugs'][str(bugID)]['dupe_of']
+    if rowDupeOf:
+        if str(rowDupeOf) in bugzillaData['bugs']:
+            return util_check_duplicated(bugzillaData, rowDupeOf, False)
+        else:
+            return bugID
+    else:
+        if isFirst:
+            return None
+        else:
+            return bugID
+
 def util_check_bugzilla_mail(statList, mail, name, date=None, bug=None):
     if mail not in statList['people']:
         statList['people'][mail] = util_create_person_bugzilla(mail, name)
diff --git a/qa/createWikiStats.py b/qa/createWikiStats.py
index db1ef13..97f868e 100755
--- a/qa/createWikiStats.py
+++ b/qa/createWikiStats.py
@@ -64,19 +64,6 @@ def util_increase_user_actions(statList, bug, mail, targets, 
action, actionTime)
             statList['period'][period]['people'][mail][action] += 1
             statList['period'][period]['people'][mail]['bugs'].append(bug)
 
-def util_check_duplicated(bugID, isFirst=True):
-    rowDupeOf = bugzillaData['bugs'][str(bugID)]['dupe_of']
-    if rowDupeOf:
-        if str(rowDupeOf) in bugzillaData['bugs']:
-            return util_check_duplicated(rowDupeOf, False)
-        else:
-            return bugID
-    else:
-        if isFirst:
-            return None
-        else:
-            return bugID
-
 def util_create_bug(summary, component, version, keywords, creationDate, 
count_cc):
     return { 'summary': summary,
              'component': component,
@@ -131,7 +118,7 @@ def analyze_bugzilla_wiki_stats(statList, bugzillaData, 
cfg):
                 statList['MostCCBugs'][rowId] = util_create_bug(
                         row['summary'], row['component'], row['version'], 
rowKeywords, creationDate, len(row['cc']))
 
-            rowDupeOf = util_check_duplicated(rowId)
+            rowDupeOf = common.util_check_duplicated(bugzillaData, rowId)
             if rowDupeOf:
                 if rowDupeOf not in statList['dupesBugs']:
                     statList['dupesBugs'][rowDupeOf] = []
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to