Skip to content

Commit

Permalink
fix clang-tidy by changing assets to warnings (#833)
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental authored Dec 5, 2023
1 parent d8b40fe commit b0425ba
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions utils/git/clang_tidy_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import re
import sys
import time
import warnings

import requests
import yaml
Expand Down Expand Up @@ -75,8 +76,9 @@ def get_pull_request_files(
timeout=github_api_timeout,
)

print(f"{result.status_code=}")
assert result.status_code == requests.codes.ok # pylint: disable=no-member
if result.status_code != requests.codes.ok:
warnings.warn("couldn't get pull request files")
continue

chunk = json.loads(result.text)

Expand All @@ -103,7 +105,9 @@ def get_pull_request_comments(
timeout=github_api_timeout,
)

assert result.status_code == requests.codes.ok # pylint: disable=no-member
if result.status_code != requests.codes.ok:
warnings.warn("couldn't get pull request comments")
continue

chunk = json.loads(result.text)

Expand Down Expand Up @@ -417,10 +421,11 @@ def split_into_chunks(lst, n):
)

# Ignore bad gateway errors (false negatives?)
assert result.status_code in (
if result.status_code not in (
requests.codes.ok, # pylint: disable=no-member
requests.codes.bad_gateway, # pylint: disable=no-member
)
):
warnings.warn("couldn't post pull review comments")

# Avoid triggering abuse detection
time.sleep(10)
Expand All @@ -447,7 +452,9 @@ def dismiss_change_requests(
timeout=github_api_timeout,
)

assert result.status_code == requests.codes.ok # pylint: disable=no-member
if result.status_code != requests.codes.ok: # pylint: disable=no-member
warnings.warn(f"couldn't dismiss change requests")
return

reviews = json.loads(result.text)

Expand Down Expand Up @@ -477,7 +484,8 @@ def dismiss_change_requests(
timeout=github_api_timeout,
)

assert result.status_code == requests.codes.ok # pylint: disable=no-member
if result.status_code != requests.codes.ok:
warnings.warn(f"couldn't dismiss {review_id=}")

# Avoid triggering abuse detection
time.sleep(10)
Expand Down

0 comments on commit b0425ba

Please sign in to comment.