Skip to content

Commit d7d98d8

Browse files
Copilotjmeridth
andcommitted
Fix linting issues - remove unused imports, fix formatting, and encoding
Co-authored-by: jmeridth <35014+jmeridth@users.noreply.github.com>
1 parent 3a626dd commit d7d98d8

File tree

4 files changed

+44
-22
lines changed

4 files changed

+44
-22
lines changed

markdown_writer.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,7 @@ def write_to_markdown(
216216
else:
217217
file.write(" None |")
218218
if "Author" in columns:
219-
file.write(
220-
f" [{issue.author}](https://{endpoint}/{issue.author}) |"
221-
)
219+
file.write(f" [{issue.author}](https://{endpoint}/{issue.author}) |")
222220
if "Time to first response" in columns:
223221
file.write(f" {issue.time_to_first_response} |")
224222
if "Time to close" in columns:

test_assignee_functionality.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import unittest
55
from unittest.mock import patch
6+
67
from markdown_writer import get_non_hidden_columns
78

89

@@ -88,8 +89,11 @@ def test_assignee_column_position(self):
8889
columns = get_non_hidden_columns(labels=None)
8990
assignee_index = columns.index("Assignee")
9091
author_index = columns.index("Author")
91-
self.assertLess(assignee_index, author_index,
92-
"Assignee column should appear before Author column")
92+
self.assertLess(
93+
assignee_index,
94+
author_index,
95+
"Assignee column should appear before Author column",
96+
)
9397

9498

9599
if __name__ == "__main__":

test_assignee_integration.py

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
import os
55
import tempfile
66
import unittest
7-
from unittest.mock import MagicMock, patch
87
from datetime import datetime, timedelta
8+
from unittest.mock import patch
9+
910
from classes import IssueWithMetrics
10-
from markdown_writer import write_to_markdown
1111
from json_writer import write_to_json
12+
from markdown_writer import write_to_markdown
1213

1314

1415
class TestAssigneeIntegration(unittest.TestCase):
@@ -47,14 +48,22 @@ def test_assignee_in_markdown_output(self):
4748
),
4849
]
4950

50-
with tempfile.NamedTemporaryFile(mode='w', suffix='.md', delete=False) as f:
51+
with tempfile.NamedTemporaryFile(mode="w", suffix=".md", delete=False) as f:
5152
output_file = f.name
5253

5354
try:
5455
write_to_markdown(
5556
issues_with_metrics=issues_with_metrics,
56-
average_time_to_first_response={"avg": timedelta(hours=3), "med": timedelta(hours=3), "90p": timedelta(hours=4)},
57-
average_time_to_close={"avg": timedelta(days=1), "med": timedelta(days=1), "90p": timedelta(days=1)},
57+
average_time_to_first_response={
58+
"avg": timedelta(hours=3),
59+
"med": timedelta(hours=3),
60+
"90p": timedelta(hours=4),
61+
},
62+
average_time_to_close={
63+
"avg": timedelta(days=1),
64+
"med": timedelta(days=1),
65+
"90p": timedelta(days=1),
66+
},
5867
average_time_to_answer=None,
5968
average_time_in_draft=None,
6069
average_time_in_labels=None,
@@ -73,18 +82,18 @@ def test_assignee_in_markdown_output(self):
7382
)
7483

7584
# Read and verify the markdown content
76-
with open(output_file, 'r') as f:
85+
with open(output_file, "r", encoding="utf-8") as f:
7786
content = f.read()
7887

7988
# Check for assignee column header
8089
self.assertIn("| Assignee |", content)
81-
90+
8291
# Check for assignee data - alice should be linked
8392
self.assertIn("[alice](https://github.com/alice)", content)
84-
93+
8594
# Check for None assignee
8695
self.assertIn("| None |", content)
87-
96+
8897
# Check that both assignee and author columns are present
8998
self.assertIn("| Author |", content)
9099

@@ -116,14 +125,22 @@ def test_assignee_in_json_output(self):
116125
),
117126
]
118127

119-
with tempfile.NamedTemporaryFile(mode='w', suffix='.json', delete=False) as f:
128+
with tempfile.NamedTemporaryFile(mode="w", suffix=".json", delete=False) as f:
120129
output_file = f.name
121130

122131
try:
123132
json_output = write_to_json(
124133
issues_with_metrics=issues_with_metrics,
125-
stats_time_to_first_response={"avg": timedelta(hours=3), "med": timedelta(hours=3), "90p": timedelta(hours=4)},
126-
stats_time_to_close={"avg": timedelta(days=1), "med": timedelta(days=1), "90p": timedelta(days=1)},
134+
stats_time_to_first_response={
135+
"avg": timedelta(hours=3),
136+
"med": timedelta(hours=3),
137+
"90p": timedelta(hours=4),
138+
},
139+
stats_time_to_close={
140+
"avg": timedelta(days=1),
141+
"med": timedelta(days=1),
142+
"90p": timedelta(days=1),
143+
},
127144
stats_time_to_answer=None,
128145
stats_time_in_draft=None,
129146
stats_time_in_labels=None,

test_markdown_writer.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ def test_write_to_markdown(self):
137137
"| Title | URL | Assignee | Author | Time to first response | Time to close |"
138138
" Time to answer | Time in draft | Time spent in bug | Created At |\n"
139139
"| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |\n"
140-
"| Issue 1 | https://github.com/user/repo/issues/1 | [charlie](https://github.com/charlie) | [alice](https://github.com/alice) | 1 day, 0:00:00 | "
141-
"2 days, 0:00:00 | 3 days, 0:00:00 | 1 day, 0:00:00 | 4 days, 0:00:00 | -5 days, 0:00:00 |\n"
140+
"| Issue 1 | https://github.com/user/repo/issues/1 | [charlie](https://github.com/charlie) | "
141+
"[alice](https://github.com/alice) | 1 day, 0:00:00 | 2 days, 0:00:00 | 3 days, 0:00:00 | "
142+
"1 day, 0:00:00 | 4 days, 0:00:00 | -5 days, 0:00:00 |\n"
142143
"| Issue 2 | https://github.com/user/repo/issues/2 | None | [bob](https://github.com/bob) | 3 days, 0:00:00 | "
143144
"4 days, 0:00:00 | 5 days, 0:00:00 | 1 day, 0:00:00 | 2 days, 0:00:00 | -5 days, 0:00:00 |\n\n"
144145
"_This report was generated with the [Issue Metrics Action](https://github.com/github/issue-metrics)_\n"
@@ -251,8 +252,9 @@ def test_write_to_markdown_with_vertical_bar_in_title(self):
251252
"| Title | URL | Assignee | Author | Time to first response | Time to close |"
252253
" Time to answer | Time in draft | Time spent in bug | Created At |\n"
253254
"| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |\n"
254-
"| Issue 1 | https://github.com/user/repo/issues/1 | [charlie](https://github.com/charlie) | [alice](https://github.com/alice) | 1 day, 0:00:00 | "
255-
"2 days, 0:00:00 | 3 days, 0:00:00 | 1 day, 0:00:00 | 1 day, 0:00:00 | -5 days, 0:00:00 |\n"
255+
"| Issue 1 | https://github.com/user/repo/issues/1 | [charlie](https://github.com/charlie) | "
256+
"[alice](https://github.com/alice) | 1 day, 0:00:00 | 2 days, 0:00:00 | 3 days, 0:00:00 | "
257+
"1 day, 0:00:00 | 1 day, 0:00:00 | -5 days, 0:00:00 |\n"
256258
"| feat&#124; Issue 2 | https://github.com/user/repo/issues/2 | None | [bob](https://github.com/bob) | 3 days, 0:00:00 | "
257259
"4 days, 0:00:00 | 5 days, 0:00:00 | None | 2 days, 0:00:00 | -5 days, 0:00:00 |\n\n"
258260
"_This report was generated with the [Issue Metrics Action](https://github.com/github/issue-metrics)_\n"
@@ -399,7 +401,8 @@ def test_writes_markdown_file_with_non_hidden_columns_only(self):
399401
"| Total number of items created | 2 |\n\n"
400402
"| Title | URL | Assignee | Author | Created At |\n"
401403
"| --- | --- | --- | --- | --- |\n"
402-
"| Issue 1 | https://www.ghe.com/user/repo/issues/1 | [charlie](https://ghe.com/charlie) | [alice](https://ghe.com/alice) | -5 days, 0:00:00 |\n"
404+
"| Issue 1 | https://www.ghe.com/user/repo/issues/1 | [charlie](https://ghe.com/charlie) | "
405+
"[alice](https://ghe.com/alice) | -5 days, 0:00:00 |\n"
403406
"| Issue 2 | https://www.ghe.com/user/repo/issues/2 | None | [bob](https://ghe.com/bob) | -5 days, 0:00:00 |\n\n"
404407
"_This report was generated with the [Issue Metrics Action](https://github.com/github/issue-metrics)_\n"
405408
"Search query used to find these items: `repo:user/repo is:issue`\n"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy