From f957a282adefa87729322d188d7b8349ed3c1410 Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Tue, 15 Oct 2024 17:28:44 -0700 Subject: [PATCH 1/4] fix: pass through report name, issue title, and search query when report is empty Signed-off-by: Zack Koppert --- issue_metrics.py | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/issue_metrics.py b/issue_metrics.py index c50b09d..eed5525 100644 --- a/issue_metrics.py +++ b/issue_metrics.py @@ -368,7 +368,23 @@ def main(): # pragma: no cover issues = get_discussions(token, search_query) if len(issues) <= 0: print("No discussions found") - write_to_markdown(None, None, None, None, None, None, None, None) + write_to_markdown( + issues_with_metrics=None, + average_time_to_first_response=None, + average_time_to_close=None, + average_time_to_answer=None, + average_time_in_labels=None, + num_issues_opened=None, + num_issues_closed=None, + num_mentor_count=None, + labels=None, + search_query=search_query, + hide_label_metrics=False, + hide_items_closed_count=False, + non_mentioning_links=False, + report_title=report_title, + output_file=output_file, + ) return else: issues = search_issues( @@ -376,7 +392,23 @@ def main(): # pragma: no cover ) if len(issues) <= 0: print("No issues found") - write_to_markdown(None, None, None, None, None, None, None, None) + write_to_markdown( + issues_with_metrics=None, + average_time_to_first_response=None, + average_time_to_close=None, + average_time_to_answer=None, + average_time_in_labels=None, + num_issues_opened=None, + num_issues_closed=None, + num_mentor_count=None, + labels=None, + search_query=search_query, + hide_label_metrics=False, + hide_items_closed_count=False, + non_mentioning_links=False, + report_title=report_title, + output_file=output_file, + ) return # Get all the metrics From 0405601ccc2906b0b2138120d70c0d922257e58a Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Wed, 16 Oct 2024 10:12:59 -0700 Subject: [PATCH 2/4] docs: update inline docs on function signature --- markdown_writer.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/markdown_writer.py b/markdown_writer.py index e9d8d3b..98ec4a9 100644 --- a/markdown_writer.py +++ b/markdown_writer.py @@ -7,14 +7,21 @@ Functions: write_to_markdown( - issues_with_metrics: List[IssueWithMetrics], - average_time_to_first_response: timedelta, - average_time_to_close: timedelta, - average_time_to_answer: timedelta, - num_issues_opened: int, - num_issues_closed: int, - num_mentor_count: int, - file: file object = None + issues_with_metrics: Union[List[IssueWithMetrics], None], + average_time_to_first_response: Union[dict[str, timedelta], None], + average_time_to_close: Union[dict[str, timedelta], None], + average_time_to_answer: Union[dict[str, timedelta], None], + average_time_in_labels: Union[dict, None], + num_issues_opened: Union[int, None], + num_issues_closed: Union[int, None], + num_mentor_count: Union[int, None], + labels=None, + search_query=None, + hide_label_metrics=False, + hide_items_closed_count=False, + non_mentioning_links=False, + report_title="", + output_file="", ) -> None: Write the issues with metrics to a markdown file. get_non_hidden_columns( From 752d61ef366a2fd3d00bbec4a1975c5f62efcb89 Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Wed, 16 Oct 2024 11:00:56 -0700 Subject: [PATCH 3/4] docs: fix docs to demonstrate type instead of defaults --- markdown_writer.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/markdown_writer.py b/markdown_writer.py index 98ec4a9..e8cb5e1 100644 --- a/markdown_writer.py +++ b/markdown_writer.py @@ -15,13 +15,13 @@ num_issues_opened: Union[int, None], num_issues_closed: Union[int, None], num_mentor_count: Union[int, None], - labels=None, - search_query=None, - hide_label_metrics=False, - hide_items_closed_count=False, - non_mentioning_links=False, - report_title="", - output_file="", + labels: List[str], + search_query: str, + hide_label_metrics: bool, + hide_items_closed_count: bool, + non_mentioning_links: bool, + report_title: str, + output_file: str, ) -> None: Write the issues with metrics to a markdown file. get_non_hidden_columns( From 747f7e04c6f04680a2fba50bfa456d3675620e1e Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Wed, 16 Oct 2024 14:18:25 -0700 Subject: [PATCH 4/4] docs: update function inline docs Signed-off-by: Zack Koppert --- test_issue_metrics.py | 1 - 1 file changed, 1 deletion(-) diff --git a/test_issue_metrics.py b/test_issue_metrics.py index 027c182..ab025af 100644 --- a/test_issue_metrics.py +++ b/test_issue_metrics.py @@ -8,7 +8,6 @@ TestSearchIssues: A class to test the search_issues function. TestGetPerIssueMetrics: A class to test the get_per_issue_metrics function. TestGetEnvVars: A class to test the get_env_vars function. - TestMain: A class to test the main function. """