patch_extension_skip_types

Add validation for latest_comment and cast suggestions_score_threshold to int
This commit is contained in:
mrT23
2024-08-20 12:11:34 +03:00
parent 772499fce1
commit 2591a5d6c1
2 changed files with 3 additions and 1 deletions

View File

@ -80,6 +80,8 @@ async def polling_loop():
if 'subject' in notification and notification['subject']['type'] == 'PullRequest':
pr_url = notification['subject']['url']
latest_comment = notification['subject']['latest_comment_url']
if not latest_comment or not isinstance(latest_comment, str):
continue
async with session.get(latest_comment, headers=headers) as comment_response:
if comment_response.status == 200:
comment = await comment_response.json()

View File

@ -522,7 +522,7 @@ class PRCodeSuggestions:
data = {"code_suggestions": []}
for j, predictions in enumerate(prediction_list): # each call adds an element to the list
if "code_suggestions" in predictions:
score_threshold = max(1, get_settings().pr_code_suggestions.suggestions_score_threshold)
score_threshold = max(1, int(get_settings().pr_code_suggestions.suggestions_score_threshold))
for i, prediction in enumerate(predictions["code_suggestions"]):
try:
if get_settings().pr_code_suggestions.self_reflect_on_suggestions: