Skip to content

Commit 7667640

Browse files
committed
refactor: consider early return optimization for dry-run
1 parent d9a8729 commit 7667640

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

commit_check/main.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ def main() -> int:
9999
"""The main entrypoint of commit-check program."""
100100
parser = get_parser()
101101
args = parser.parse_args()
102+
103+
if args.dry_run:
104+
return PASS
105+
102106
check_results: list[int] = []
103107

104108
with error_handler():
@@ -119,9 +123,6 @@ def main() -> int:
119123
if args.merge_base:
120124
check_results.append(branch.check_merge_base(checks))
121125

122-
if args.dry_run:
123-
return PASS
124-
125126
return PASS if all(val == PASS for val in check_results) else FAIL
126127

127128

0 commit comments

Comments
 (0)