-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New rule to detect inactive patch authors #2426
base: master
Are you sure you want to change the base?
Conversation
rev_ids = {rev_id for bug in bugs.values() for rev_id in bug["rev_ids"]} | ||
try: | ||
inactive_authors = self._get_inactive_patch_authors(list(rev_ids)) | ||
except Exception as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid using Exception
as the error-catching type where possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense! I removed the try-except block here: 243515d. I made sure to do a dry-run and noticed that I did not encounter any errors, so I don't think the exception handler is necessary.
except Exception as e: | ||
logging.error(f"Failed to abandon patch {rev_id} for bug {bugid}: {e}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as #2426 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed here: 3a88716
except Exception as e: | ||
logging.error(f"Error fetching revisions: {e}") | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as #2426 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed here: 9eabe77
bugbot/user_activity.py
Outdated
user["unavailable_until"] = phab_user["attachments"][ | ||
"availability" | ||
]["until"] | ||
except Exception as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as #2426 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed here: d1b0350
@suhaibmujahid I'm leaving this one for you since you started the review already. |
"""Bugs with patches authored by inactive patch authors""" | ||
|
||
def __init__(self): | ||
super(InactivePatchAuthors, self).__init__() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Python 3, you do not need to pass any arguments to super()
:
super(InactivePatchAuthors, self).__init__() | |
super().__init__() |
def __init__(self): | ||
super(InactivePatchAuthors, self).__init__() | ||
self.phab = PhabricatorAPI(utils.get_login_info()["phab_api_key"]) | ||
self.user_activity = UserActivity(include_fields=["nick"], phab=self.phab) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the nick
field needed here?
Resolves #1532.
Introduces a new rule to detect and unassign inactive patch authors on Phabricator.
If the patch is not already closed, it will be abandoned.
Checklist
to-be-announced
tag added if this is worth announcing