Skip to content

Commit b03fbdb

Browse files
committed
Fix else after return
1 parent 5219861 commit b03fbdb

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

post/clang_tidy_review/clang_tidy_review/__init__.py

+7-10
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def get_auth_from_arguments(args: argparse.Namespace) -> Auth:
143143
return Auth.AppAuth(args.app_id, private_key).get_installation_auth(
144144
args.installation_id
145145
)
146-
elif (
146+
if (
147147
args.app_id
148148
or args.private_key
149149
or args.private_key_file_path
@@ -427,27 +427,24 @@ def get_diagnostic_file_path(clang_tidy_diagnostic, build_dir):
427427
file_path = clang_tidy_diagnostic["DiagnosticMessage"]["FilePath"]
428428
if file_path == "":
429429
return ""
430-
elif os.path.isabs(file_path):
430+
if os.path.isabs(file_path):
431431
return os.path.normpath(os.path.abspath(file_path))
432-
elif "BuildDirectory" in clang_tidy_diagnostic:
432+
if "BuildDirectory" in clang_tidy_diagnostic:
433433
return os.path.normpath(
434434
os.path.abspath(
435435
os.path.join(clang_tidy_diagnostic["BuildDirectory"], file_path)
436436
)
437437
)
438-
else:
439-
return os.path.normpath(os.path.abspath(file_path))
438+
return os.path.normpath(os.path.abspath(file_path))
440439

441440
# Pre-clang-tidy-9 format
442-
elif "FilePath" in clang_tidy_diagnostic:
441+
if "FilePath" in clang_tidy_diagnostic:
443442
file_path = clang_tidy_diagnostic["FilePath"]
444443
if file_path == "":
445444
return ""
446-
else:
447-
return os.path.normpath(os.path.abspath(os.path.join(build_dir, file_path)))
445+
return os.path.normpath(os.path.abspath(os.path.join(build_dir, file_path)))
448446

449-
else:
450-
return ""
447+
return ""
451448

452449

453450
def find_line_number_from_offset(offset_lookup, filename, offset):

post/clang_tidy_review/clang_tidy_review/post.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,7 @@ def main() -> int:
105105
pull_request, review, args.max_comments, lgtm_comment_body, args.dry_run
106106
)
107107

108-
if args.num_comments_as_exitcode:
109-
return exit_code
110-
else:
111-
return 0
108+
return exit_code if args.num_comments_as_exitcode else 0
112109

113110

114111
if __name__ == "__main__":

0 commit comments

Comments
 (0)