Skip to content

Commit 7047248

Browse files
Jake AdamsJake Adams
authored andcommitted
Fix lint errors and remove obsolete code.
1 parent fb05049 commit 7047248

File tree

2 files changed

+15
-24
lines changed

2 files changed

+15
-24
lines changed

issue_metrics.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ def get_per_issue_metrics(
166166

167167
return issues_with_metrics, num_issues_open, num_issues_closed
168168

169+
169170
def evaluate_markdown_file_size(output_file: str) -> None:
170171
file_name_without_extension = Path(output_file).stem
171172
max_char_count = 65535
@@ -180,6 +181,7 @@ def evaluate_markdown_file_size(output_file: str) -> None:
180181
See https://github.com/github/issue-metrics/blob/main/docs/dealing-with-large-issue-metrics.md"
181182
)
182183

184+
183185
def main(): # pragma: no cover
184186
"""Run the issue-metrics script.
185187

test_issue_metrics.py

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ def test_get_per_issue_metrics_with_hide_envs(self):
177177
"HIDE_TIME_TO_ANSWER": "false",
178178
"HIDE_TIME_TO_CLOSE": "false",
179179
"HIDE_TIME_TO_FIRST_RESPONSE": "false",
180-
"OUTPUT_FILE": "test_issue_metrics.md"
181180
},
182181
)
183182
def test_get_per_issue_metrics_without_hide_envs(self):
@@ -483,16 +482,10 @@ def test_get_per_issue_metrics_with_discussion_with_hide_envs(self):
483482
class TestEvaluateMarkdownFileSize(unittest.TestCase):
484483
"""Test suite for the evaluate_markdown_file_size function."""
485484

486-
@patch.dict(
487-
os.environ,
488-
{
489-
"GH_TOKEN": "test_token",
490-
"SEARCH_QUERY": "is:issue is:open repo:user/repo",
491-
"OUTPUT_FILE": "test_issue_metrics.md"
492-
}
493-
)
494485
@patch("issue_metrics.markdown_too_large_for_issue_body")
495-
def test_markdown_too_large_for_issue_body_called_with_output_file(self, mock_evaluate):
486+
def test_markdown_too_large_for_issue_body_called_with_output_file(
487+
self, mock_evaluate
488+
):
496489
"""
497490
Test that the function uses the output_file.
498491
"""
@@ -501,19 +494,13 @@ def test_markdown_too_large_for_issue_body_called_with_output_file(self, mock_ev
501494

502495
mock_evaluate.assert_called_with("test_issue_metrics.md", 65535)
503496

504-
@patch.dict(
505-
os.environ,
506-
{
507-
"GH_TOKEN": "test_token",
508-
"SEARCH_QUERY": "is:issue is:open repo:user/repo",
509-
"OUTPUT_FILE": "test_issue_metrics.md"
510-
}
511-
)
512497
@patch("issue_metrics.print")
513498
@patch("shutil.move")
514499
@patch("issue_metrics.split_markdown_file")
515500
@patch("issue_metrics.markdown_too_large_for_issue_body")
516-
def test_split_markdown_file_when_file_size_too_large(self, mock_evaluate, mock_split, mock_move, mock_print):
501+
def test_split_markdown_file_when_file_size_too_large(
502+
self, mock_evaluate, mock_split, mock_move, mock_print
503+
):
517504
"""
518505
Test that the function is called with the output_file
519506
environment variable.
@@ -522,16 +509,18 @@ def test_split_markdown_file_when_file_size_too_large(self, mock_evaluate, mock_
522509
evaluate_markdown_file_size("test_issue_metrics.md")
523510

524511
mock_split.assert_called_with("test_issue_metrics.md", 65535)
525-
mock_move.assert_has_calls([
526-
call("test_issue_metrics.md", "test_issue_metrics_full.md"),
527-
call("test_issue_metrics_0.md", "test_issue_metrics.md")
528-
])
512+
mock_move.assert_has_calls(
513+
[
514+
call("test_issue_metrics.md", "test_issue_metrics_full.md"),
515+
call("test_issue_metrics_0.md", "test_issue_metrics.md"),
516+
]
517+
)
529518
mock_print.assert_called_with(
530519
"Issue metrics markdown file is too large for GitHub issue body and has been \
531520
split into multiple files. ie. test_issue_metrics.md, test_issue_metrics_1.md, etc. \
532521
The full file is saved as test_issue_metrics_full.md\n\
533522
See https://github.com/github/issue-metrics/blob/main/docs/dealing-with-large-issue-metrics.md"
534-
)
523+
)
535524

536525

537526
if __name__ == "__main__":

0 commit comments

Comments
 (0)