removed good and put is_code_related in selection instead

This commit is contained in:
Karma Riuk
2025-05-14 09:17:16 +02:00
parent ea3a2b72e5
commit ae516b6c34
2 changed files with 11 additions and 7 deletions

View File

@ -23,7 +23,8 @@ class Comment:
class Selection: class Selection:
comment_suggests_change: bool comment_suggests_change: bool
diff_after_address_change: Optional[bool] diff_after_address_change: Optional[bool]
good: Optional[bool] is_code_related: bool
@dataclass @dataclass
class Metadata: class Metadata:

View File

@ -122,6 +122,7 @@ def main(
pr_url = f"https://github.com/{entry.metadata.repo}/pull/{entry.metadata.pr_number}" pr_url = f"https://github.com/{entry.metadata.repo}/pull/{entry.metadata.pr_number}"
print(f"\nPull Request : {pr_url}") print(f"\nPull Request : {pr_url}")
is_code_related = any(file.file.endswith('.java') for file in entry.comments)
for comment in entry.comments: for comment in entry.comments:
print("\nComment:", comment.body) print("\nComment:", comment.body)
@ -136,15 +137,17 @@ def main(
entry.metadata.selection = Selection( entry.metadata.selection = Selection(
comment_suggests_change=False, comment_suggests_change=False,
diff_after_address_change=None, diff_after_address_change=None,
good=False, is_code_related=any(file.file.endswith('.java') for file in entry.comments),
) )
break break
if validation_mode == ValidationMode.COMMENT: if validation_mode == ValidationMode.COMMENT:
entry.metadata.selection = Selection( entry.metadata.selection = Selection(
comment_suggests_change=True, comment_suggests_change=True,
diff_after_address_change=None, diff_after_address_change=sel.diff_after_address_change
good=True, if sel is not None
else None,
is_code_related=is_code_related,
) )
n_good += 1 n_good += 1
break break
@ -169,7 +172,7 @@ def main(
entry.metadata.selection = Selection( entry.metadata.selection = Selection(
comment_suggests_change=True, comment_suggests_change=True,
diff_after_address_change=False, diff_after_address_change=False,
good=False, is_code_related=is_code_related,
) )
break break
@ -208,7 +211,7 @@ def main(
entry.metadata.selection = Selection( entry.metadata.selection = Selection(
comment_suggests_change=True, comment_suggests_change=True,
diff_after_address_change=False, diff_after_address_change=False,
good=False, is_code_related=is_code_related,
) )
break break
@ -223,7 +226,7 @@ def main(
entry.metadata.selection = Selection( entry.metadata.selection = Selection(
comment_suggests_change=True, comment_suggests_change=True,
diff_after_address_change=True, diff_after_address_change=True,
good=True, is_code_related=is_code_related,
) )
if len(relevant_diffs) > 0: if len(relevant_diffs) > 0:
n_good += 1 n_good += 1