Skip to content

Commit 54dfe61

Browse files
chore: auto fixes from pre-commit.com hooks
1 parent 45c85fa commit 54dfe61

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

main.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,10 @@ def run_pr_message_checks(pr_messages: list[str], result_file: TextIO) -> int:
150150
for index, msg in enumerate(pr_messages, start=1):
151151
subject = msg.splitlines()[0] if msg else "<empty commit message>"
152152
result_file.write(f"\n--- Commit {index}/{total_messages}: {subject}\n")
153-
has_failure = run_check_command(
154-
["--message"], result_file, input_text=msg
155-
) != 0 or has_failure
153+
has_failure = (
154+
run_check_command(["--message"], result_file, input_text=msg) != 0
155+
or has_failure
156+
)
156157
return 1 if has_failure else 0
157158

158159

main_test.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,19 @@ def test_falls_back_to_base_ref_when_merge_ref_is_unavailable(self):
182182
def test_exception_returns_empty(self):
183183
with (
184184
patch.dict(os.environ, {"GITHUB_EVENT_NAME": "pull_request"}),
185-
patch("main.get_messages_from_merge_ref", side_effect=Exception("git failed")),
185+
patch(
186+
"main.get_messages_from_merge_ref", side_effect=Exception("git failed")
187+
),
186188
):
187189
result = main.get_pr_commit_messages()
188190
self.assertEqual(result, [])
189191

190192

191193
class TestGitMessageReaders(unittest.TestCase):
192194
def test_get_messages_from_merge_ref(self):
193-
mock_result = MagicMock(returncode=0, stdout="fix: first\n\x00feat: second\n\x00")
195+
mock_result = MagicMock(
196+
returncode=0, stdout="fix: first\n\x00feat: second\n\x00"
197+
)
194198
with patch("main.subprocess.run", return_value=mock_result) as mock_run:
195199
result = main.get_messages_from_merge_ref()
196200
self.assertEqual(result, ["fix: first", "feat: second"])
@@ -417,7 +421,9 @@ def test_same_repo_not_fork(self):
417421
"base": {"repo": {"full_name": "owner/repo"}},
418422
}
419423
}
420-
with tempfile.NamedTemporaryFile(mode="w", suffix=".json", delete=False) as file_obj:
424+
with tempfile.NamedTemporaryFile(
425+
mode="w", suffix=".json", delete=False
426+
) as file_obj:
421427
json.dump(event, file_obj)
422428
event_path = file_obj.name
423429
with patch.dict(os.environ, {"GITHUB_EVENT_PATH": event_path}):
@@ -434,7 +440,9 @@ def test_different_repo_is_fork(self):
434440
"base": {"repo": {"full_name": "owner/repo"}},
435441
}
436442
}
437-
with tempfile.NamedTemporaryFile(mode="w", suffix=".json", delete=False) as file_obj:
443+
with tempfile.NamedTemporaryFile(
444+
mode="w", suffix=".json", delete=False
445+
) as file_obj:
438446
json.dump(event, file_obj)
439447
event_path = file_obj.name
440448
with patch.dict(os.environ, {"GITHUB_EVENT_PATH": event_path}):

0 commit comments

Comments
 (0)