From 93ceb734055869deb17e5c0c7d455f847a7e6a8d Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Thu, 8 May 2025 22:12:51 +0000 Subject: [PATCH 1/2] fix: remove mentor count from stats if mentors are disabled Signed-off-by: Zack Koppert --- issue_metrics.py | 3 +++ markdown_writer.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/issue_metrics.py b/issue_metrics.py index a1b3f11..ab9cb91 100644 --- a/issue_metrics.py +++ b/issue_metrics.py @@ -281,6 +281,7 @@ def main(): # pragma: no cover search_query=search_query, hide_label_metrics=False, hide_items_closed_count=False, + enable_mentor_count=enable_mentor_count, non_mentioning_links=False, report_title=report_title, output_file=output_file, @@ -307,6 +308,7 @@ def main(): # pragma: no cover search_query=search_query, hide_label_metrics=False, hide_items_closed_count=False, + enable_mentor_count=enable_mentor_count, non_mentioning_links=False, report_title=report_title, output_file=output_file, @@ -370,6 +372,7 @@ def main(): # pragma: no cover search_query=search_query, hide_label_metrics=hide_label_metrics, hide_items_closed_count=hide_items_closed_count, + enable_mentor_count=enable_mentor_count, non_mentioning_links=non_mentioning_links, report_title=report_title, output_file=output_file, diff --git a/markdown_writer.py b/markdown_writer.py index e506a4f..ed0d05d 100644 --- a/markdown_writer.py +++ b/markdown_writer.py @@ -100,6 +100,7 @@ def write_to_markdown( search_query=None, hide_label_metrics=False, hide_items_closed_count=False, + enable_mentor_count=False, non_mentioning_links=False, report_title="", output_file="", @@ -168,6 +169,7 @@ def write_to_markdown( file, hide_label_metrics, hide_items_closed_count, + enable_mentor_count, ) # Write second table with individual issue/pr/discussion metrics @@ -243,6 +245,7 @@ def write_overall_metrics_tables( file, hide_label_metrics, hide_items_closed_count=False, + enable_mentor_count=False, ): """Write the overall metrics tables to the markdown file.""" if any( @@ -316,5 +319,6 @@ def write_overall_metrics_tables( file.write(f"| Number of items that remain open | {num_issues_opened} |\n") if not hide_items_closed_count: file.write(f"| Number of items closed | {num_issues_closed} |\n") - file.write(f"| Number of most active mentors | {num_mentor_count} |\n") + if enable_mentor_count: + file.write(f"| Number of most active mentors | {num_mentor_count} |\n") file.write(f"| Total number of items created | {len(issues_with_metrics)} |\n\n") From c45c5db5d6d8fbafdfff4bbae3d8950a110a0e76 Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Thu, 8 May 2025 15:25:56 -0700 Subject: [PATCH 2/2] fix: fix tests to reflect when mentor count should and shouldnt be in the markdown table Signed-off-by: Zack Koppert --- test_markdown_writer.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test_markdown_writer.py b/test_markdown_writer.py index 3927106..e8f5b08 100644 --- a/test_markdown_writer.py +++ b/test_markdown_writer.py @@ -129,7 +129,6 @@ def test_write_to_markdown(self): "| --- | ---: |\n" "| Number of items that remain open | 2 |\n" "| Number of items closed | 1 |\n" - "| Number of most active mentors | 5 |\n" "| Total number of items created | 2 |\n\n" "| Title | URL | Author | Time to first response | Time to close |" " Time to answer | Time in draft | Time spent in bug | Created At |\n" @@ -240,7 +239,6 @@ def test_write_to_markdown_with_vertical_bar_in_title(self): "| --- | ---: |\n" "| Number of items that remain open | 2 |\n" "| Number of items closed | 1 |\n" - "| Number of most active mentors | 5 |\n" "| Total number of items created | 2 |\n\n" "| Title | URL | Author | Time to first response | Time to close |" " Time to answer | Time in draft | Time spent in bug | Created At |\n" @@ -369,6 +367,7 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self): search_query="repo:user/repo is:issue", hide_label_metrics=True, hide_items_closed_count=True, + enable_mentor_count=True, non_mentioning_links=True, report_title="Issue Metrics", output_file="issue_metrics.md",