Exemplo n.º 1
0
def is_debug_in_local():
    debug_log_console("JiraInfo().instance.is_debug(): " +
                      str(JiraInfo().instance.is_debug()))
    debug_log_console("sys_invariant.debug_against_oss: " +
                      str(sys_invariant.get_debug_against_oss()))
    return (JiraInfo().instance.is_debug()) and (
        not sys_invariant.get_debug_against_oss())
Exemplo n.º 2
0
def generate_bug_priority_barhchart(bug_list):
    priority_data, priority_label = bug_data_and_label_classified_in_catalog(
        bug_list, ["Low", "Medium", "High", "Highest"], 'priority')
    debug_log_console(str(priority_data))
    debug_log_console(str(priority_label))
    return generate_barh_chart(priority_label, priority_data,
                               online_bug_priority_png)
Exemplo n.º 3
0
def do_bug_analysis():
    basic_base64_token = system_init()
    if not is_system_available(basic_base64_token):
        print("system check failed, please ask admin")
        return

    bug_list = get_bug_list(basic_base64_token)

    # No.1 graphic - bug summary
    summary_barchart = generate_bug_summary_barchart(bug_list)
    debug_log_console("summary bar chart image generated")

    # No.2 graphic - bug priority
    priority_barchart = generate_bug_priority_barhchart(bug_list)
    debug_log_console("priority bar chart filename generated")

    # No.3 graphic - bug classification
    classification_piechart = generate_bug_classification_piechart(bug_list)
    debug_log_console("classification bar chart filename generated")

    # No.4 graphic - bug unclassified
    unclassified_piechart = generate_bug_unclassified_piechart(bug_list)
    debug_log_console("unclassified pie chart filename generated")

    online_bug_source = write_bug_list_to_csv(bug_list)
    debug_log_console(online_bug_source.decode("utf-8"))

    # final step - compose and send email
    graphics = [
        summary_barchart, priority_barchart, classification_piechart,
        unclassified_piechart
    ]
    send_email_from_graphics(graphics, online_bug_source)
Exemplo n.º 4
0
def generate_bug_classification_piechart(bug_list):
    classify_data, classify_label = bug_data_and_label_classified_in_catalog(
        bug_list, [
            "Fore-End", "Product Logic", "Server", "Third Part",
            "Wrong Reported"
        ], 'bug classify')
    debug_log_console(str(classify_data))
    debug_log_console(str(classify_label))
    return generate_pie_chart(classify_label, classify_data,
                              online_bug_classification_png, "Classification")
Exemplo n.º 5
0
def search_online_bug_in_json(base64_api_token, jql_uri=""):
    uri = "/rest/api/3/search?" + jql_uri
    print("search bug from " + uri)
    response = get_response(base64_api_token, uri)
    debug_log_console(
        json.dumps(json.loads(response.text),
                   sort_keys=True,
                   indent=4,
                   separators=(",", ": ")))
    return json.loads(response.text)
Exemplo n.º 6
0
 def fetch_list_from_jira(self):
     while not self.is_completed():
         debug_log_console("fetch data from " + str(self.next_start_at) +
                           "...")
         online_bug_json = fetch_date_from_jira_cloud(
             self.basic_base64_token, self.sprint_start_date,
             self.next_start_at)
         if is_fetch_data_error(online_bug_json):
             return False
         self.update_bug_list_info(online_bug_json)
         self.append_bugs(online_bug_json)
     return True
Exemplo n.º 7
0
def get_fields_in_dict(basic_base64_token):
    field = {}

    uri = "/rest/api/3/field"
    print("fetch field from " + uri)
    response = get_response(basic_base64_token, uri)

    for item in json.loads(response.text):
        id_str = item['id']
        if id_str.startswith('customfield'):
            field[item['name']] = id_str
            debug_log_console(item['name'] + "----" + id_str)
    return field
Exemplo n.º 8
0
def generate_bug_unclassified_piechart(bug_list):
    classify_data, classify_label = bug_data_and_label_classified_in_catalog(
        bug_list, [
            "Fore-End", "Product Logic", "Server", "Third Part",
            "Wrong Reported"
        ], 'bug classify')
    unclassified_label = ["Clarified", "Non-Clarified"]
    unclassified_data = [
        sum(classify_data), (len(bug_list.bugs) - sum(classify_data))
    ]
    debug_log_console(str(unclassified_label))
    debug_log_console(str(unclassified_data))
    return generate_pie_chart(unclassified_label, unclassified_data,
                              online_bug_unclassified_png, "Unclassified")
Exemplo n.º 9
0
def generate_bug_summary_barchart(bug_list):
    # find the latest sprint bugs
    last_sprint_bugs, sprint_start_date = get_the_last_sprint_bugs(bug_list)
    debug_log_console(str(sprint_start_date))

    # store the count into file
    sprint_bug_summary_json = store_count_into_file(
        get_sprint_bug_summary_filename(), len(last_sprint_bugs),
        sprint_start_date)

    if sprint_bug_summary_json is "":
        return None
    # generate chart
    return generate_online_bug_summary_chart(
        sprint_bug_summary_json, get_online_bug_summary_png_filename())
Exemplo n.º 10
0
def append_latest_sprint_info(last_sprint_bugs_count,
                              sprint_online_bug_summary_json_data,
                              sprint_start_date):
    debug_log_console(str(sprint_online_bug_summary_json_data))
    is_updated = False
    sprint_start_date_str = datetime.datetime.strftime(sprint_start_date,
                                                       date_format["in_file"])
    for sprint_summary in sprint_online_bug_summary_json_data:
        if sprint_summary["sprint date"] == sprint_start_date_str:
            sprint_summary["sprint bug count"] = last_sprint_bugs_count
            is_updated = True
            break
    if not is_updated:
        sprint_online_bug_summary_json_data.append({
            "sprint date":
            sprint_start_date_str,
            "sprint bug count":
            last_sprint_bugs_count
        })
    return sprint_online_bug_summary_json_data
Exemplo n.º 11
0
        def send_email(self, msg_content):
            print(self.from_addr)
            print(self.smtp_pass)
            smtp = None
            try:
                smtp = smtplib.SMTP_SSL(
                    host=self.smtp_host,
                    port=self.smtp_port,
                    timeout=int(self.smtp_timeout),
                )
                smtp.connect(host=self.smtp_host, port=self.smtp_port)
                smtp.login(self.smtp_user, self.smtp_pass)
                smtp.sendmail(self.from_addr, self.receivers, msg_content)
                smtp.close()
                debug_log_console(str(self.from_addr))
                debug_log_console(str(self.receivers))
                debug_log_console('mail send finished.')

            except (Exception, ) as e:
                send_err = str(e)
                print(send_err)
            finally:
                if smtp is not None:
                    print("smtp close")
                    smtp.close()
Exemplo n.º 12
0
def fetch_date_from_jira_cloud(basic_base64_token, sprint_start_date,
                               start_at):
    search_uri = compose_search_jql_uri(sprint_start_date, start_at)
    debug_log_console(search_uri)
    online_bug_json = search_online_bug_in_json(basic_base64_token, search_uri)
    return online_bug_json
Exemplo n.º 13
0
def generate_online_bug_summary_chart(sprint_bug_summary_json, filename):
    dates, counts = convert_summary_into_dates_and_counts(
        sprint_bug_summary_json)
    debug_log_console(dates)
    return generate_bar_chart(dates, counts, filename)