[Libreoffice-commits] dev-tools.git: 2 commits - qa/bugzillaDataAnalyzer.py qa/common.py qa/createBlogReport.py
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Apr 8 09:06:11 UTC 2019
qa/bugzillaDataAnalyzer.py | 28 ++++++++++++----------------
qa/common.py | 25 +++++++++++++++++++++++++
qa/createBlogReport.py | 36 ++++++++----------------------------
3 files changed, 45 insertions(+), 44 deletions(-)
New commits:
commit 08c53f97294c2fa00d89b61b94b02b8d0aa5998b
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon Apr 8 11:04:39 2019 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Apr 8 11:04:39 2019 +0200
QA: ignore uitests commits
diff --git a/qa/bugzillaDataAnalyzer.py b/qa/bugzillaDataAnalyzer.py
index 5fa73f1..f971d56 100755
--- a/qa/bugzillaDataAnalyzer.py
+++ b/qa/bugzillaDataAnalyzer.py
@@ -272,7 +272,7 @@ def analyze_bugzilla_data(statList, bugzillaData, cfg):
if commentMail == "libreoffice-commits at lists.freedesktop.org":
commentText = comment['text']
author = commentText.split(' committed a patch related')[0]
- if author not in bugFixers:
+ if author not in bugFixers and 'uitest' not in commentText.lower():
bugFixers.append(author)
difftimeFixed = (commentDate - creationDate).days
weekFixed = str(commentDate.year) + '-' + str(commentDate.strftime("%V"))
commit b3cc75a72cb984e49019327c2d03b1fd84f035eb
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Apr 5 13:20:13 2019 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Apr 8 10:53:01 2019 +0200
QA: Use date arguments in the data analyzer
diff --git a/qa/bugzillaDataAnalyzer.py b/qa/bugzillaDataAnalyzer.py
index 63ce9dd..5fa73f1 100755
--- a/qa/bugzillaDataAnalyzer.py
+++ b/qa/bugzillaDataAnalyzer.py
@@ -10,8 +10,6 @@
import common
import datetime
-reportPeriodDays = 365
-
# Use enhancements, bugs, all
kindOfData = ['enhancements', 'bugs', 'all']
@@ -143,7 +141,7 @@ def analyze_bugzilla_data(statList, bugzillaData, cfg):
rowProduct = row['product']
#get information about created bugs in reportPeriod
- if creationDate >= cfg['reportPeriod']:
+ if common.util_check_range_time(creationDate, cfg):
week = str(creationDate.year) + '-' + str(creationDate.strftime("%V"))
month = str(creationDate.year) + '-' + str(creationDate.strftime("%m"))
util_increase_action(statList[kindOfTicket]['created'], rowId, creatorMail, rowStatus, rowProduct,
@@ -168,6 +166,8 @@ def analyze_bugzilla_data(statList, bugzillaData, cfg):
for action in row['history']:
actionMail = action['who']
actionDate = datetime.datetime.strptime(action['when'], "%Y-%m-%dT%H:%M:%SZ")
+ if not common.util_check_range_time(actionDate, args):
+ continue
common.util_check_bugzilla_mail(
statList, actionMail, '', actionDate, rowId)
@@ -178,7 +178,7 @@ def analyze_bugzilla_data(statList, bugzillaData, cfg):
addedStatus = change['added']
removedStatus = change['removed']
- if actionDate >= cfg['reportPeriod']:
+ if common.util_check_range_time(actionDate, cfg):
if common.isClosed(addedStatus) and common.isClosed(row['status']):
if isClosed:
util_decrease_action(statList[kindOfTicket]['closed'], rowId, creatorMail, rowStatus, rowProduct,
@@ -232,7 +232,8 @@ def analyze_bugzilla_data(statList, bugzillaData, cfg):
newStatus = None
- if actionDate >= cfg['reportPeriod'] and row['resolution'] == 'FIXED':
+ if common.util_check_range_time(actionDate, cfg) and \
+ row['resolution'] == 'FIXED':
if addedResolution == 'FIXED':
fixedBugs[rowId] = actionDate
isFixed = True
@@ -245,7 +246,8 @@ def analyze_bugzilla_data(statList, bugzillaData, cfg):
keywordsAdded = change['added'].split(", ")
for keyword in keywordsAdded:
if keyword in lKeywords:
- if actionDate >= cfg['reportPeriod'] and keyword in rowKeywords:
+ if common.util_check_range_time(actionDate, cfg) and \
+ keyword in rowKeywords:
weekKeyword = str(actionDate.year) + '-' + str(actionDate.strftime("%V"))
monthKeyword = str(actionDate.year) + '-' + str(actionDate.strftime("%m"))
difftimeKeyword = (actionDate - creationDate).days
@@ -266,7 +268,7 @@ def analyze_bugzilla_data(statList, bugzillaData, cfg):
common.util_check_bugzilla_mail(
statList, commentMail, '', commentDate, rowId)
- if rowId in fixedBugs:
+ if common.util_check_range_time(commentDate, cfg) and rowId in fixedBugs:
if commentMail == "libreoffice-commits at lists.freedesktop.org":
commentText = comment['text']
author = commentText.split(' committed a patch related')[0]
@@ -425,21 +427,15 @@ def data_Report(statList) :
else:
util_print_QA_line_data(statList, v, kind, k, 10)
-def runCfg():
- cfg = {}
- cfg['reportPeriod'] = common.util_convert_days_to_datetime(reportPeriodDays)
- return cfg
-
if __name__ == '__main__':
+ args = common.util_parse_date_args()
print("Reading and writing data to " + common.dataDir)
- cfg = runCfg()
-
bugzillaData = common.get_bugzilla()
statList = util_create_statList()
- analyze_bugzilla_data(statList, bugzillaData, cfg)
+ analyze_bugzilla_data(statList, bugzillaData, args)
data_Report(statList)
diff --git a/qa/common.py b/qa/common.py
index 96dae66..34d6feb 100755
--- a/qa/common.py
+++ b/qa/common.py
@@ -10,6 +10,7 @@
import os
import datetime
import json
+import argparse
from pyshorteners import Shortener
#Path where bugzilla_dump.py is
@@ -115,6 +116,30 @@ def util_create_short_url(fp, lBugs, text='Link'):
shortener = Shortener('Tinyurl', timeout=9000)
print('\t\t+ ' + text + ': ' + shortener.short(url), file=fp)
+def mkdate(datestr):
+ try:
+ return datetime.datetime.strptime(datestr, '%Y-%m-%d')
+ except ValueError:
+ raise argparse.ArgumentTypeError(datestr + ' is not a proper date string')
+
+def util_parse_date_args():
+ parser=argparse.ArgumentParser()
+ parser.add_argument('Date',type=mkdate, nargs=2, help="Introduce the starting date as first" + \
+ " argument and the ending date as second argument. FORMAT: YYYY-MM-DD")
+ args=parser.parse_args()
+
+ if args.Date[0] >= args.Date[1]:
+ print('Argument 1 must be older than argument 2... Closing!!')
+ exit()
+
+ return parser.parse_args()
+
+def util_check_range_time(xDate, cfg):
+ if xDate >= cfg.Date[0] and xDate < cfg.Date[1]:
+ return True
+ else:
+ return False
+
def get_bugzilla():
fileName = dataDir + 'bugzilla_dump.json'
return util_load_file(fileName)
diff --git a/qa/createBlogReport.py b/qa/createBlogReport.py
index 64d2e1d..f0c6a96 100755
--- a/qa/createBlogReport.py
+++ b/qa/createBlogReport.py
@@ -8,9 +8,8 @@
#
import common
-from datetime import datetime, timedelta
-import argparse
import math
+from datetime import datetime, timedelta
import matplotlib
import matplotlib.pyplot as plt
@@ -69,11 +68,6 @@ def util_decrease_action(value, creatorMail, day):
if value['difftime']:
value['difftime'].pop()
-def check_date(xDate, cfg):
- if xDate >= cfg.Date[0] and xDate < cfg.Date[1]:
- return True
- else:
- return False
def daterange(cfg):
for n in range(int ((cfg.Date[1] - cfg.Date[0]).days)):
@@ -114,7 +108,7 @@ def analyze_bugzilla_data(statList, bugzillaData, cfg):
creatorMail = row['creator']
#get information about created bugs in the period of time
- if check_date(creationDate, cfg):
+ if common.util_check_range_time(creationDate, cfg):
creationDay = str(creationDate.strftime("%Y-%m-%d"))
util_increase_action(statList['created'], rowId, creatorMail, creationDay)
@@ -271,7 +265,7 @@ def analyze_bugzilla_data(statList, bugzillaData, cfg):
highCountPerDay[actionDay] -= 1
isHighClosed = True
- if check_date(actionDate, cfg):
+ if common.util_check_range_time(actionDate, cfg):
if removedStatus == "UNCONFIRMED":
util_increase_action(statList['confirmed'], rowId, actionMail, actionDay, diffTime)
dayConfirmed = actionDay
@@ -293,7 +287,7 @@ def analyze_bugzilla_data(statList, bugzillaData, cfg):
isVerified = False
elif change['field_name'] == 'resolution':
- if check_date(actionDate, cfg):
+ if common.util_check_range_time(actionDate, cfg):
addedResolution = change['added']
removedResolution = change['removed']
if addedResolution == 'FIXED':
@@ -316,7 +310,7 @@ def analyze_bugzilla_data(statList, bugzillaData, cfg):
keywordsAdded = change['added'].lower().split(", ")
keywordsRemoved = change['removed'].lower().split(", ")
- if check_date(actionDate, cfg):
+ if common.util_check_range_time(actionDate, cfg):
for keyword in keywordsAdded:
if keyword in lKeywords:
util_increase_action(statList['keywords'][keyword], rowId, actionMail, actionDay, diffTime)
@@ -351,7 +345,7 @@ def analyze_bugzilla_data(statList, bugzillaData, cfg):
isBibisectRequest = False
elif change['field_name'] == 'blocks':
- if check_date(actionDate, cfg):
+ if common.util_check_range_time(actionDate, cfg):
if change['added']:
for metabug in change['added'].split(', '):
if int(metabug) in row['blocks']:
@@ -368,7 +362,7 @@ def analyze_bugzilla_data(statList, bugzillaData, cfg):
common.util_check_bugzilla_mail(
statList, commentMail, '', commentDate, rowId)
- if check_date(commentDate, cfg) and rowId in fixedBugs:
+ if common.util_check_range_time(commentDate, cfg) and rowId in fixedBugs:
if commentMail == "libreoffice-commits at lists.freedesktop.org":
commentText = comment['text']
author = commentText.split(' committed a patch related')[0]
@@ -593,22 +587,8 @@ def createReport(statList):
print(makeStrong('Check <a href="https://wiki.documentfoundation.org/QA/GetInvolved">the Get Involved page</a> out now!'), file=fp)
fp.close()
-def mkdate(datestr):
- try:
- return datetime.strptime(datestr, '%Y-%m-%d')
- except ValueError:
- raise argparse.ArgumentTypeError(datestr + ' is not a proper date string')
-
if __name__ == '__main__':
- parser=argparse.ArgumentParser()
- parser.add_argument('Date',type=mkdate, nargs=2, help="Introduce the starting date as first" + \
- " argument and the ending date as second argument. FORMAT: YYYY-MM-DD")
- args=parser.parse_args()
-
- if args.Date[0] >= args.Date[1]:
- print('Argument 1 must be older than argument 2... Closing!!')
- exit()
-
+ args = common.util_parse_date_args()
print("Reading and writing data from " + common.dataDir)
bugzillaData = common.get_bugzilla()
More information about the Libreoffice-commits
mailing list