bin/check-missing-unittests.py |   62 ++++++++++++++++++++++++-----------------
 1 file changed, 37 insertions(+), 25 deletions(-)

New commits:
commit 5dae4ad45be14ea5ab29308f024b8ea1dc1a02e9
Author:     Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
AuthorDate: Thu Sep 7 16:48:40 2023 +0300
Commit:     Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
CommitDate: Thu Sep 14 18:00:59 2023 +0200

    check-missing-unittests: change to dump JSON
    
    Change-Id: I697db0cb18e0a5119be74486a2258dfb35161c04
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156667
    Tested-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
    Tested-by: Jenkins

diff --git a/bin/check-missing-unittests.py b/bin/check-missing-unittests.py
index 5ea891396d6a..0ee36ef76aaf 100755
--- a/bin/check-missing-unittests.py
+++ b/bin/check-missing-unittests.py
@@ -21,6 +21,19 @@ def splitList(lst, n):
     for i in range(0, len(lst), n):
         yield lst[i:i + n]
 
+def whiteboardNotes(whiteboard):
+    if not whiteboard:
+        return ''
+    if ' ' in whiteboard:
+        whiteboardList = reversed(whiteboard.split(' '))
+        for w in whiteboardList:
+            if w.startswith("unitTestNotes"):
+                return w.split(':')[1]
+    elif whiteboard.startswith("unitTestNotes"):
+        return whiteboard.split(':')[1]
+
+    return ''
+
 def main(ignoredBugs):
     results = {
         'export': {
@@ -154,7 +167,10 @@ def main(ignoredBugs):
                 if bugId not in hasTestSet:
                     listOfBugIdsWithoutTest.append(bugId)
 
+
     bugzillaJson = []
+    resultList = []
+    fixList = []
     #Split the list into different chunks for the requests, otherwise it fails
     for chunk in splitList(listOfBugIdsWithoutTest, 50):
         urlGet = 'https://bugs.documentfoundation.org/rest/bug?id=' + 
','.join(chunk)
@@ -163,49 +179,45 @@ def main(ignoredBugs):
         rGet.close()
         bugzillaJson.extend(rawData['bugs'])
 
-    print()
-    print('{{TopMenu}}')
-    print('{{Menu}}')
-    print('{{Menu.Development}}')
-    print()
-    print('This report is generated by ' + os.path.basename(sys.argv[0]))
-    print()
-    print('Date: ' + str(datetime.datetime.now()))
-    print()
-    print('Commits: ' + str(len(commits)))
-    print()
-    print('Branch: ' + branch.decode().strip())
-    print()
-    print('Hash: ' + str(last_hash.decode().strip()))
-
     for k,v in results.items():
-        print('\n== ' + k + ' ==')
         for k1, v1 in v.items():
-            print('\n=== ' + k1 + ' ===')
             for bugId, info in v1.items():
 
                 resolution = ''
                 keywords = []
                 priority = ''
+                notes = ''
                 for bug in bugzillaJson:
                     if str(bug['id']) == str(bugId):
                         resolution = bug['resolution']
                         keywords = bug['keywords']
                         priority = bug['priority']
+                        notes = whiteboardNotes(bug['whiteboard'])
                         break
 
                 # Only care about FIXED bugs
                 # Ignore performance bugs and accessibility bugs
                 if resolution and resolution == 'FIXED' and 'perf' not in 
keywords \
                         and 'accessibility' not in keywords:
-                    print(
-                        "# {} - [{}] {} - 
[https://bugs.documentfoundation.org/show_bug.cgi?id={} tdf#{}]".format(
-                        info[0], priority.upper(), info[1], bugId, bugId))
-
-    print('\n== ignored bugs ==')
-    print(' '.join(ignoredBugs))
-    print()
-    print('[[Category:QA]][[Category:Development]]')
+                    fixList.append({
+                        "id": bugId,
+                        "date": info[0],
+                        "priority": priority.upper(),
+                        "summary": info[1],
+                        "maintopic":k,
+                        "subtopic":k1,
+                        "notes": notes
+                    })
+
+    resultList.append([{
+        "Generator": os.path.basename(sys.argv[0]),
+        "Date": str(datetime.datetime.now()),
+        "Commits": str(len(commits)),
+        "Branch": branch.decode().strip(),
+        "Hash": str(last_hash.decode().strip()),
+    }])
+    resultList.append(fixList)
+    print(json.dumps(resultList))
 
 def usage():
     message = """usage: {program} [bugs to ignore (each one is one argument)]

Reply via email to