Skip to content

Commit

Permalink
Fix else after return
Browse files Browse the repository at this point in the history
  • Loading branch information
ZedThree committed Jul 19, 2024
1 parent 5219861 commit b03fbdb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
17 changes: 7 additions & 10 deletions post/clang_tidy_review/clang_tidy_review/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def get_auth_from_arguments(args: argparse.Namespace) -> Auth:
return Auth.AppAuth(args.app_id, private_key).get_installation_auth(
args.installation_id
)
elif (
if (
args.app_id
or args.private_key
or args.private_key_file_path
Expand Down Expand Up @@ -427,27 +427,24 @@ def get_diagnostic_file_path(clang_tidy_diagnostic, build_dir):
file_path = clang_tidy_diagnostic["DiagnosticMessage"]["FilePath"]
if file_path == "":
return ""
elif os.path.isabs(file_path):
if os.path.isabs(file_path):
return os.path.normpath(os.path.abspath(file_path))
elif "BuildDirectory" in clang_tidy_diagnostic:
if "BuildDirectory" in clang_tidy_diagnostic:
return os.path.normpath(
os.path.abspath(
os.path.join(clang_tidy_diagnostic["BuildDirectory"], file_path)
)
)
else:
return os.path.normpath(os.path.abspath(file_path))
return os.path.normpath(os.path.abspath(file_path))

# Pre-clang-tidy-9 format
elif "FilePath" in clang_tidy_diagnostic:
if "FilePath" in clang_tidy_diagnostic:
file_path = clang_tidy_diagnostic["FilePath"]
if file_path == "":
return ""
else:
return os.path.normpath(os.path.abspath(os.path.join(build_dir, file_path)))
return os.path.normpath(os.path.abspath(os.path.join(build_dir, file_path)))

else:
return ""
return ""


def find_line_number_from_offset(offset_lookup, filename, offset):
Expand Down
5 changes: 1 addition & 4 deletions post/clang_tidy_review/clang_tidy_review/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,7 @@ def main() -> int:
pull_request, review, args.max_comments, lgtm_comment_body, args.dry_run
)

if args.num_comments_as_exitcode:
return exit_code
else:
return 0
return exit_code if args.num_comments_as_exitcode else 0


if __name__ == "__main__":
Expand Down

0 comments on commit b03fbdb

Please sign in to comment.